csharp基础练习题:描述列表【难度:1级】:

Write函数describeList告诉如果列表为空或仅包含一个元素以上.

编程目标:

 using NUnit.Framework;
 using System;
 using System.Collections.Generic;
public class Describe
{
    public static string describeList(List list)
    {
       return "";
    }
 }


测试样例:

namespace Solution {
  using NUnit.Framework;
  using System;
  using System.Collections.Generic;
  // TODO: Replace examples and use TDD development by writing your own tests
  [TestFixture]
  public class SolutionTest
    List empty = new List();
    List one  = new List(){1};
    List moreThan = new List(){2,3};
    [Test]
    public void MyTest()
    {
      Assert.AreEqual("empty", Describe.describeList(empty));


最佳答案(多种解法):

点击查看答案

更多关联题目:

csharp高级练习题:在运行时创建一个简单的类【难度:5级】–景越C# 经典编程题库,不同难度C# 练习题,适合自学C# 的新手进阶训练

免责申明

本博客所有编程题目及答案均收集自互联网,主要用于供网友学习参考,如有侵犯你的权益请联系管理员及时删除,谢谢
题目收集至https://www.codewars/
https://www.codewars/kata/describe-a-list

更多推荐

csharp基础练习题:描述列表【难度:1级】--景越C#经典编程题库,不同难度C#练习题,适合自学C#的新手进阶训练