ICode9

精准搜索请尝试: 精确搜索
  • WPF 关于将 ManipulationDeltaEventArgs 的 Manipulators 属性返回值修改为 ReadOnlyCollection 类型的提议2022-09-15 20:00:09

    这是一个 WPF 框架的 API 变更提议,记录一下博客 讨论的地方是: How about change the type of ManipulationDeltaEventArgs.Manipulators property to ReadOnlyCollection · Discussion #6249 · dotnet/wpf 问题: 在 WPF 里,放在 ManipulationDeltaEventArgs 类型的 Manipulators

  • How can I add an item to a IEnumerable<T> collection?2022-09-08 15:33:59

    How can I add an item to a IEnumerable<T> collection? My question as title above. For example IEnumerable<T> items = new T[]{new T("msg")}; items.ToList().Add(new T("msg2")); but after all it only has 1 item inside. Can we

  • Cannot convert from an IEnumerable<T> to an ICollection<T>2022-09-08 15:30:09

    Cannot convert from an IEnumerable<T> to an ICollection<T> I have defined the following: public ICollection<Item> Items { get; set; } When I run this code: Items = _item.Get("001"); I get the following message: Error 3 Ca

  • LINQPad测试 IEnumerable & IQueryable2022-08-10 17:32:07

    1.IEnumberable IEnumerable<Customers> customers =Customers.Where(q => q.CompanyName.StartsWith("A")); customers = customers.Take<Customers>(10); customers.Dump(); 转成SQL: SELECT [Extent1]

  • IEnumerable 和 IQueryable2022-07-24 22:35:18

    IEnumerable 是内存的操作,在内存里执行Linq操作(客户端评估)。 IQueryable 是分析预生成SQL语句,最后在数据库里执行(服务器端评估)。 IQueryable 遇到终结操作:ToList,ToArray,Count,Max,Min等操作时,就会立即执行,将数据查询到内存里。              非终结操作: GroupBy,OrderBy

  • C#依赖注入(直白明了)讲解 一看就会系列2022-07-01 11:32:24

    最基础的:UI-BLL-DAL   这是我们耳熟能详的分层   首先我听到依赖注入之后看似非常的复杂   实际则是:为了实现不同的团队在不同的层上工作。我们可以让一个团队处理数据访问层,一个团队处理业务层,一个团队处理UI。    首先建立:最基本的三层架构 实体层: public class Produ

  • [C#] Epplus LoadFromCollection 按照指定格式导出Excel2022-06-28 16:35:07

    Epplus中利用对象集合来生成Excel内容,共有四种方式: public ExcelRangeBase LoadFromCollection<T>(IEnumerable<T> Collection); public ExcelRangeBase LoadFromCollection<T>(IEnumerable<T> Collection, bool PrintHeaders); public ExcelRangeBase LoadFromColle

  • C# Task.Parallel2022-06-15 22:06:20

    此示例演示了使用多种语言构造实现并行循环的几种方法。 1 using System.Threading.Tasks; 2 class Test 3 { 4 static int N = 1000; 5 6 static void TestMethod() 7 { 8 // Using a named method. 9 Parallel.For(0, N, Method2);

  • IQueryable 和 IEnumerable 的区别2022-04-13 15:01:19

      来源:https://blog.guoqianfan.com/2019/11/17/distinguish-between-IQueryable-and-IEnumerable-in-CSharp/ 前言 不管是Linq to object,还是Linq to sql或Linq to Entity,IQueryable和IEnumerable都是延迟执行的,它们之间的区别仅仅在于扩展方法的参数类型不同。(迭代/枚举方式

  • 【ASP.NET Core】MVC模型绑定:自定义InputFormatter读取CSV内容2022-03-28 19:36:23

    在上一篇文章中,老周介绍了用自定义 ModelBinder 的方式实现一个 API(或MVC操作方法)可以同时支持 JSON 格式和 Form-data 格式的数据正文。今天该轮到 InputFormatter 了——接下来老周会演示如何实现自定义的 InputFormatter,使其可以读取 CSV 格式的正文。 CSV 的格式比较简单,一般

  • C# Linq SelectMany用法学习2022-02-17 10:34:28

    C# Linq SelectMany用法学习 C# Linq Select public class Person { public string Name { get; set; } public int Age { get; set; } } List<Person> persons = new List<Person>() { new Person() { Name="A",Age=10 }, new Person()

  • foreach和IEnumerable+yield和IEnumerator2022-02-07 20:33:45

      C#里,foreach可以算是个高一等级的循环,因为想要使用foreach必须实现IEnumberable,然后还需要在这个接口的唯一方法中,用yield return返回元素,才能达到foreach的循环效果。 class MyList : IEnumerable { string[] arr = new string[] { "a", "b", "c" }; public IEn

  • foreach和IEnumerable+yield和IEnumerator2022-02-07 20:33:14

      C#里,foreach可以算是个高一等级的循环,因为想要使用foreach必须实现IEnumberable,然后还需要在这个接口的唯一方法中,用yield return返回元素,才能达到foreach的循环效果。 class MyList : IEnumerable { string[] arr = new string[] { "a", "b", "c" }; public IEn

  • Linq实现InnerJoin&LeftJoin2022-01-24 13:32:04

    public static class LinqEx { public static IEnumerable<TResult> LeftExcludingJoin<TSource, TInner, TKey, TResult>(this IEnumerable<TSource> source, IEnumerable<TInner>

  • [译]. NET 6 中的 LINQ 改进2022-01-17 09:33:27

    介绍 接下来我将给大家重点介绍一下.Net 6 之后的一些新的变更,文章都是来自于外国大佬的文章,我这边进行一个翻译,并加上一些自己的理解和解释。 源作者链接:https://blog.okyrylchuk.dev/linq-improvements-in-net-6 正文 *OrDefault 方法的默认值 Enumerable.FirstOrDefault方法返

  • 协变和逆变2022-01-07 14:04:38

    概念 协变:以out修饰的泛型类型叫做协变类型,协变只能返回(当返回值),用于返回参数,协变T只能用来当返回值使用 逆变:以in修饰的泛型类型叫做逆变类型,逆变只能当参数传进来,用于接收参数,逆变T只能用来当参数传递 协变和逆变都是单向的。in可读不可写,out可写不可读 创建两个类,基类:Person,

  • c#-List<T>的Add()和Append()的区别2021-11-18 13:58:19

    今天遇到一个bug:往List< double>里加元素,结果加了半天,长度还是0。。。最后发现是用了Append而不是Add List<double> d = new List<double>(); for (int i = 0; i < 10; i++) { d.Append(0); } Console.WriteLine(d.Count); // 是0 换到Add就可以正确添加元素了。 IEnuma

  • linq-groupBy2021-11-16 16:34:24

    public static IEnumerable<IGrouping<TKey, TSource>> GroupBy<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector) { return new GroupedEnumerable<TSource, TKey, TSource>(source, ke

  • linq-Except2021-11-16 16:31:28

    源码: public static IEnumerable<TSource> Except<TSource>(this IEnumerable<TSource> first, IEnumerable<TSource> second) { if (first == null) throw Error.ArgumentNull("first"); if (sec

  • IEnumerable可枚举类型接口2021-11-02 12:00:12

    IEnumerable:可枚举类型,可迭代类型 IEnumerator:枚举器 让类实现可以遍历 字符串和数组还有集合都可以直接进行foreach遍历,是因为他们都继承了IEnumerable接口并且实现了该接口。 我们自己定义的类不能遍历,如果我们要实现可以遍历的话,就要让自定义类也实现IEnumerable接口

  • C#--IEnumerable 与 IEnumerator 的区别(转载)2021-11-02 09:33:40

    一、 IEnumerator           解释:它是一个的集合访问器,使用foreach语句遍历集合或数组时,就是调用 Current、MoveNext()的结果。 // 定义如下public interface IEnumerator { // 返回结果: 集合中的当前元素。 object Current { get; }

  • Autofac Exception Summary Autofac异常汇总2021-10-20 17:31:16

    2021-10-20 15:42:51.740 +08:00 [ERR] System.ObjectDisposedException: Instances cannot be resolved and nested lifetimes cannot be created from this LifetimeScope as it (or one of its parent scopes) has already been disposed.   at Autofac.Core.Lifetime.Life

  • DropDownList绑定数据2021-09-09 08:00:31

    2、方法2:SelectList对象绑定法 ASP.NET MVC为DropDownList和ListBox(都在html中使用select标记)准备了一个辅助类型:SelectList。 SelectList继承自MultiSelectList,而后者实现了IEnumerable<SelectListItem>。也就是说,SelectList可以直接作为Html.DropDownList方法的第二个参数。 Mu

  • AutoMapper之集合和数组映射2021-09-08 11:33:14

    9.集合和数组映射 在项目中,集合和数组使用的很多的,继续下来就讲讲他们的映射,很简单。 /// <summary> /// 源对象 /// </summary> public class Source { public int Value { get; set; } public string Text { get; set; } } /// <summary> /// 目标对象 /// </summary>

  • C# 协变和逆变2021-08-28 10:00:31

        伴随Visual Studio2010的发布,C#这门语言提供一些新的特性,包含协变(Covariant)和逆变(Contravariant)、动态(Dynamic)和DLR、命名参数和可选参数、索引属性、COM调用优化和嵌入COM互操作类型。写本文的目的主要是探讨下泛型类型的协变和逆变,按照以往版本.NET新特性的增加,一般是

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有