初始化
This commit is contained in:
55
ConsoleAppTest/Program.cs
Normal file
55
ConsoleAppTest/Program.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
namespace ConsoleAppTest
|
||||
{
|
||||
public struct AFS
|
||||
{
|
||||
public int x;
|
||||
public int y;
|
||||
public string Name;
|
||||
}
|
||||
internal class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
|
||||
List<Com> l = new List<Com>()
|
||||
{
|
||||
new Com(){id=1,Name="boolive"},
|
||||
new Com(){id=2,Name="boolive"}
|
||||
};
|
||||
List<Com> l1 = new List<Com>()
|
||||
{
|
||||
new Com(){id=1,Name="boolive"},
|
||||
new Com(){id=3,Name="boolive"}
|
||||
};
|
||||
var DDD= l1.Except(l).ToList();
|
||||
var DDD1= l.Except(l1).ToList();
|
||||
|
||||
|
||||
|
||||
|
||||
List<Product> lll = new List<Product>()
|
||||
{
|
||||
new Product{id=1,ComId=1},
|
||||
new Product{id=2,ComId=2},
|
||||
new Product{id=3,ComId=3},
|
||||
};
|
||||
|
||||
|
||||
var str = l.Where(s => s.Name.StartsWith("JavaScript")).DefaultIfEmpty().First();
|
||||
Console.WriteLine("str=" + str.Name); //输出空白
|
||||
//使用string str1 = ListInt.Where(s => s.StartsWith("JavaScript")).First(); 如去掉DefaultEmpty就会报异常
|
||||
Console.WriteLine("Hello, World!");
|
||||
}
|
||||
}
|
||||
public struct Com
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string Name { get; set; }
|
||||
}
|
||||
public class Product
|
||||
{
|
||||
public int id { get; set; }
|
||||
public int ComId { get; set; }
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user