我将asp.net应用程序迁移到4.0.现在我收到错误"无法找到类型或命名空间名称'IQueryable'".对System.Linq的引用无效,我在引用列表中找不到它.System.Linq在哪里?
可能重复:
将System.Array转换为List
我想将aPersonDataArr转换为list IList<aPersonDataArr> aPerList = ???和viceVersa - 从列表到数组.如何做到这一点,我不愿意使用LINQ.还有其他办法吗?
class PersonData
{
public string PersonName;
public int Age;
}
class Program
{
static void Main(string[] args)
{
PersonData[] aPersonDataArr = new PersonData[2];
for (int i = 0; i < aPersonDataArr.Length; i++)
{
aPersonDataArr[i].PersonName = "abcd";
aPersonDataArr[i].Age = 10;
}
}
}
Run Code Online (Sandbox Code Playgroud) 我有这样的功能:
public static Mesh MeshFromPolylines(List<Polyline> nurbsCurves, int type, bool weld)
{
..code..
}
Run Code Online (Sandbox Code Playgroud)
然后我超载:
public static Mesh MeshFromPolylines(Polyline[] nurbsCurves, int type, bool weld)
{
..code..
}
Run Code Online (Sandbox Code Playgroud)
有没有办法编写第二个函数而无需复制粘贴相同的代码?这两个函数里面的代码完全相同.差别就是输入List<Polyline>和Polyline[].
我想转换string[][]为List<List<string>>.
例如.
List<List<string>> listOfListReturned = new List<List<string>>();
string[][] twoDArrOfString = new string[2][];
Run Code Online (Sandbox Code Playgroud)
我想转换twoDArrOfString 为listOfListReturned
请建议,怎么做?
此致,Vivek