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的更多相关文章

  1. [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 ...

  2. [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 ...

  3. LeetCode Minimum Moves to Equal Array Elements II

    原题链接在这里:https://leetcode.com/problems/minimum-moves-to-equal-array-elements-ii/ 题目: Given a non-empt ...

  4. LeetCode Minimum Moves to Equal Array Elements

    原题链接在这里:https://leetcode.com/problems/minimum-moves-to-equal-array-elements/ 题目: Given a non-empty i ...

  5. 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 ...

  6. 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 ...

  7. 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 ...

  8. 【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 ...

  9. 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 ...

随机推荐

  1. Mysql 的存储引擎,myisam和innodb的区别

    MyISAM 是非事务的存储引擎,innodb是支持事务的存储引擎. innodb的引擎比较适合于插入和更新操作比较多的应用,而MyISAM 则适合用于频繁查询的应用 . MyISAM --表锁,in ...

  2. Parse_ini_file

    parse_ini_file() 函数解析一个配置文件,并以数组的形式返回其中的设置. 注释:本函数可以用来读取你自己的应用程序的配置文件.本函数与 php.ini 文件没有关系,该文件在运行脚本时就 ...

  3. C语言初学者代码中的常见错误与瑕疵(9)

    题目 字母的个数 现在给你一个由小写字母组成字符串,要你找出字符串中出现次数最多的字母,如果出现次数最多字母有多个那么输出最小的那个. 输入:第一行输入一个正整数T(0<T<25) 随后T ...

  4. Java中this关键字的使用

    本文介绍了在Java中this关键字的作用于使用方法 当局部变量和成员变量重名时,在方法中使用this时,表示的是该方法所在类中的成员变量.(this指的是当前对象自己) 如:public class ...

  5. [置顶] 一个懦弱的IT人

    对自己近来的学习和工作做一个总结,规划一下未来. 还是从大三暑假说起,稀里糊涂的被拉去参加电子设计大赛,熬过了一段痛苦的时间.原本我是学计算机的,对硬件不太熟悉.不过经过一段时间痛苦的断断续续的学习, ...

  6. web跨页弹窗选值

    最近在项目中看到这样一种效果——点击当前网页文本框,然后弹出一个缩小的网页,并在网页里选择或填写数据,然后又返回当前网页,小网页关闭.感觉非常不错,其实在以前网上也看见过,只是当时没有留心.今天抽时间 ...

  7. python核心编程学习记录之数字

    仅用于整数的操作

  8. js里的匿名函数 数组排序

    // 匿名函数:其实就是函数的简写形式 var method =function(){ alert("123"); } method(); // 匿名函数可以用于事件的处理 fun ...

  9. asp.net中调用javascript自定义函数的方法(包括引入JavaScript文件)总结

    通常javascript代码可以与HTML标签一起直接放在前 端页面中,但如果JS代码多的话一方面不利于维护,另一方面也对搜索引擎不友好,因为页面因此而变得臃肿:所以一般有良好开发习惯的程序员都会把 ...

  10. ecshop增加pc扫描二维码微信支付功能代码

    ecshop开发网站,如果没有手机版,又想通过微信支付,可以加入pc二维码扫描微信支付功能 工具/原料 ecshop商城系统,phpqrcode,WxPayPubHelper 公众号已申请微信支付 方 ...