
C#
moernagedian
计算机专业老学长,每天向前一小步。
展开
-
c#count()和length的区别
C#Length 表示数组项的个数,是个属性;Count() 也是表示项的个数,是个方法,它的值和 Length 一样。实际上严格地说 Count() 不是数组的内容,而是 IEnumerable 的内容。可能问题:由于是IEnumerable 的内容,所以list为空采用count会有异常。...原创 2021-10-11 09:42:09 · 1185 阅读 · 0 评论 -
C# Json序列化
C# Json序列化string json = System.Text.Json.JsonSerializer.Serialize(foo);Foo f = JsonSerializer.Deserialize<Foo>(json);原创 2021-09-17 11:17:53 · 224 阅读 · 0 评论 -
C# 字符串转数组,数组转字符串
字符串转数组,数组转字符串1 string str = "1,2,3,4,5";2 string[] strArray = str.Split(','); //字符串转数组3 str = string.Empty;4 str = string.Join(",", strArray);//数组转成字符串原创 2021-09-17 11:05:55 · 584 阅读 · 0 评论 -
C# List.Select方法代码
companyList.Select(o => new CompanyVM { Id = o.Id, Name = o.Name }).ToList();["randCode"] = verifyPoints.Select(s => s.X + "," + s.Y).JoinAsString(",") public List<TagsModel> GetModelList(List<Tag> tags) {转载 2021-08-31 16:48:07 · 11019 阅读 · 0 评论