Printing Array elements with Comma delimiters
https://www.codewars.com/kata/printing-array-elements-with-comma-delimiters/train/csharp
using System;
using System.Collections.Generic; public class Kata
{
public static string PrintArray(object[] array)
{
var list = new List<string>();
foreach (var item in array)
{
var obj = item as object[];
if (obj == null)
{
list.Add(item.ToString());
}
else
{
string temp = PrintArray(obj);
list.Add(temp);
}
}
return string.Join(",", list);
}
}
关于数组类型的判断,可以使用
a.GetType().IsArray
Printing Array elements with Comma delimiters的更多相关文章
- [LeetCode] Minimum Moves to Equal Array Elements II 最少移动次数使数组元素相等之二
Given a non-empty integer array, find the minimum number of moves required to make all array element ...
- [LeetCode] Minimum Moves to Equal Array Elements 最少移动次数使数组元素相等
Given a non-empty integer array of size n, find the minimum number of moves required to make all arr ...
- LeetCode Minimum Moves to Equal Array Elements II
原题链接在这里:https://leetcode.com/problems/minimum-moves-to-equal-array-elements-ii/ 题目: Given a non-empt ...
- LeetCode Minimum Moves to Equal Array Elements
原题链接在这里:https://leetcode.com/problems/minimum-moves-to-equal-array-elements/ 题目: Given a non-empty i ...
- LeetCode 453 Minimum Moves to Equal Array Elements
Problem: Given a non-empty integer array of size n, find the minimum number of moves required to mak ...
- Leetcode-462 Minimum Moves to Equal Array Elements II
#462. Minimum Moves to Equal Array Elements II Given a non-empty integer array, find the minimum n ...
- LeetCode 453. Minimum Moves to Equal Array Elements C#
Given a non-empty integer array of size n, find the minimum number of moves required to make all arr ...
- 【LeetCode】462. Minimum Moves to Equal Array Elements II
Given a non-empty integer array, find the minimum number of moves required to make all array element ...
- 13. leetcode 453. Minimum Moves to Equal Array Elements
Given a non-empty integer array of size n, find the minimum number of moves required to make all arr ...
随机推荐
- MKCOL not allowed
通过TortoiseSvn操作GitHub的时候出现下图提示: 原因:尝试在根目录创建新的文件夹(文件),貌似是不被允许的行为 解决:只能在trunk 或者 branches下再新建文件夹(文件)
- React笔记_(5)_react语法4
ajax 数据应用场景 在真实的开发环境中,拿到了产品需求,第一件事不是逼着后台开发人员先完成,然后前端再介入开发,这样太浪费时间. 正确的做法是跟后端人员先商量好接口名称,请求参数,返回的数据格式等 ...
- awk,perl,python的命令行参数处理
Python,Perl,Bash命令行参数 Part I 日常经常性的和Perl,Python,Bash打交道,但是又经常性的搞混他们之间,在命令行上的特殊性和index的区别,Python真的是人性 ...
- 安装centos7.1 32bit时,没有可用的网络设备的解决方法
安装的系统镜像文件:CentOS-7-i386-LiveGNOME-1511.iso 虚拟机版本: 问题: 原因: 原先我在这里选择的时候,以为自己安装的不是64位的,所以没有选择centos 64, ...
- PHP将多张小图拼接成一张大图
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> < ...
- ectouch第六讲 之表常用链接
ECTouch1.0 常用链接:精品属性商品mobile/index.php?m=default&c=category&type=best 新品属性商品mobile/index.php ...
- [充电]Code Review
参考:http://blog.jobbole.com/83595/ http://www.kuqin.com/shuoit/20150319/345323.html 让 Code Review成为一种 ...
- javaBean的使用方法;
在jsp页面中使用javaBean:三个标签: <jsp:useBean>标签 <jsp:setProperty>标签 <jsp:getProperty>标签 首先 ...
- Asp.net 与 jsp 交互 (打开或跳转页面)
//// 打开固定大小窗体 Response.Write("<script>window.open('Tree1_edit.aspx','child','width=300,he ...
- Hiking 分类: 比赛 HDU 函数 2015-08-09 21:24 3人阅读 评论(0) 收藏
Hiking Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others) Total Subm ...