Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/316.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 需要帮助来解释这一点。我是C语言的初学者#_C#_.net - Fatal编程技术网

C# 需要帮助来解释这一点。我是C语言的初学者#

C# 需要帮助来解释这一点。我是C语言的初学者#,c#,.net,C#,.net,我在网上搜索了很久关于IEnumerable的信息,但它们都在program.cs文件中 有人能告诉我下面的代码是什么吗 namespace customBank.Interfaces { public class Bank : customBank // the bank take the format of customBank as interface. { public IEnumerable<IStatementRow> GetMiniSta

我在网上搜索了很久关于IEnumerable的信息,但它们都在program.cs文件中

有人能告诉我下面的代码是什么吗

namespace customBank.Interfaces
{
    public class Bank : customBank // the bank take the format of customBank as interface.
    {
        public IEnumerable<IStatementRow> GetMiniStatement(IAccount account)
    }
}
namespace customBank.Interfaces
{
公共类银行:customBank//该银行以customBank的格式作为接口。
{
公共IEnumerable GetMinistration(IAccount帐户)
}
}
请参见:

另见:

一旦你读到它,你就会很好地理解代码中发生了什么。

IEnumerable是一个可以循环的“事物”列表。在这种情况下,它是一个IStatementRow事件列表


调用GetMinistration函数时,将返回IStatementRow内容的列表。

简而言之,它告诉您银行已经实现了customBank。银行有一个方法GetMinistration,它将帐户作为输入并提供可枚举。你应该在谷歌上搜索
C\IEnumerable
。你到底在问什么?这个代码不完整。我猜这里提供的练习是为存根创建一个方法体。这个练习可能要求您获取帐户的语句行列表并返回它们。代码看起来很奇怪,因为它们将接口作为参数和对象传递。很多人不知道可以将接口声明为变量,并为其设置订阅该接口的对象。非常感谢。。问题是要我返回一份最近5笔交易的清单。很抱歉,我不是C#person,在Ruby中:这将类似于account.transactions.last(5)。如果内存中有IEnumerable对象,那么您可以按降序对它们排序,并取其中五个。。。IEnumerable list=getMinistration(arg1).OrderByDescending(x=>x.FieldName).Take(5)