C# C中的TypeScript“map”函数?

C# C中的TypeScript“map”函数?,c#,linq,typescript,C#,Linq,Typescript,我有TypeScript中的代码,我需要C中的等效代码 声明: private sessionCommands: SessionCommand[]; // . . . // Create array in constructor. this.sessionCommands = new Array(); // . . . // Push few objects to array in some method 然后获取数据。这是很重要的一部分,如何在C中实现这一点 var data = this.

我有TypeScript中的代码,我需要C中的等效代码

声明:

private sessionCommands: SessionCommand[];
// . . .
// Create array in constructor.
this.sessionCommands = new Array();
// . . .
// Push few objects to array in some method
然后获取数据。这是很重要的一部分,如何在C中实现这一点

var data = this.sessionCommands.map(x => x.identifier + " " + x.getParameter() + ";").join("\n");

.NET世界中的等效功能是选择函数:

public static IEnumerable<TResult> Select<TSource, TResult>(this IEnumerable<TSource> source, Func<TSource, TResult> selector);

.NET世界中的等效功能是选择函数:

public static IEnumerable<TResult> Select<TSource, TResult>(this IEnumerable<TSource> source, Func<TSource, TResult> selector);

这是LINQ的Select方法。与其显示TypeScript代码,不如描述您试图实现的内容。这样,您就不会依赖于既懂TypeScript又懂C的读者。我猜您只是在寻找LINQ中的Select方法……我正在从TypeScript进行迁移。我还不是100%确定我在做什么:这是LINQ的Select方法。与其显示TypeScript代码,不如描述一下您试图实现的目标。这样,您就不会依赖于既懂TypeScript又懂C的读者。我猜您只是在寻找LINQ中的Select方法……我正在从TypeScript进行迁移。我还不能100%确定我在做什么: