如何从C#中的List获取值? [英] how to get the values from List in C#?
本文介绍了如何从C#中的List获取值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何从C#中的List中获取值?
how to get the values from List in C#?
推荐答案
下面是一个可以帮助您的链接:
[列表]
Here is a link which may can help you:
[list]
可能会有所帮助,
It might be helpful,
static void Main(string[] args)
{
var dataToFind = "One";
Console.WriteLine(Find(dataToFind));
}
private static string Find(string dataToFind)
{
IList<string> myList = new List<string>() { "One", "Two", "Three" };
return myList.Where(item => item.Equals(dataToFind)).FirstOrDefault();
}
:)
:)
下面的代码
我根据以下代码解决了问题.
code below
i resolved the problem based on below code.
foreach(Modelclass rec in bizclass.Callfn())
{
string id= rec.fieldname();
}
这篇关于如何从C#中的List获取值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文