
C# --- 语法糖
文章平均质量分 78
C#各种语法糖
马达加斯加D
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
C# --- yield关键字 和 Lazy Execution
立即执行(Eager Evaluation)延迟执行(使用yield)示例:生成斐波那契数列。原创 2025-04-12 23:33:55 · 920 阅读 · 0 评论 -
C# --- 多线程和Task-based Asynchronous Pattern
异步机制的使用场景TAP --- Task-based Asynchronous PatternExample --- async/await异步方法的返回值异步机制和多线程的关系原创 2023-06-29 00:09:20 · 819 阅读 · 1 评论 -
C# --- 委托机制 delegate 和 回调方法 callback
什么是委托机制委托机制的优点C# 中的Action 和 Func委托机制的主要用处 --- 回调 Callback原创 2023-07-02 22:01:56 · 2351 阅读 · 0 评论 -
C# --- Lambda Expression
Intro to Lambda Expressionlambda表达式的参数lambda表达式的返回值如何使用lambda Expression原创 2023-07-09 18:43:42 · 822 阅读 · 0 评论 -
C# --- IEnumerable 和 IEnumerator
正确做法:IEnumerable + IEnumerator。确保多次遍历互不干扰。原创 2025-04-12 23:06:12 · 976 阅读 · 0 评论 -
C# --- LINQ
LINQ的全称为Language Integrated Query, 为各种查询(包括对象查询,数据库查询,XML查询) 提供了统一模型.LINQ源于SQL,但比SQL更加强大,更加灵活.LINQ可以用类似于SQL的形式对C# Collection中的对象进行查询LINQ可以在代码中对数据库进行查询,编程语言和数据库之间配合上的鸿沟,也就是不用再手动拼接SQL字符串去查询数据库.可读性强:LINQ增加了代码的可读性,因此其他开发人员可以很轻松地理解和维护。原创 2025-03-15 19:35:29 · 1082 阅读 · 0 评论 -
C# --- Null Operator
Null-Coalescing Operator ??Null-Coalescing Assignment Operator ??=Null-Conditional Operator ?.原创 2023-07-10 18:37:06 · 423 阅读 · 0 评论 -
C# --- Extension Method
【代码】C# ---Extension Method。原创 2024-03-19 20:47:16 · 338 阅读 · 0 评论 -
C# --- cancellation token
如何终止一个Task --- cancellation tokenExample --- Complete Task via return OperatorExample --- Complete Task via ThrowIfCancellationRequested()Example --- Register Operation Cancellation Handler原创 2023-07-03 00:38:30 · 522 阅读 · 1 评论 -
C# --- .Net Framework中的Binding Redirect
为什么需要绑定重定向?在.Net Framework 中, 假设你有一个应用程序 A,它引用了libray B 和 library C, 同时B又引用了D的1.1.1.0版本,而C引用了D的1.1.1.1版本. 现在我们面临一个冲突,因为在运行时无法加载不同版本的同一个程序集一般会报出以下Error Message为了解决这个冲突,你可以使用绑定重定向,通常是指向新版本(但也可以指向旧版本)。原创 2024-07-21 18:18:38 · 475 阅读 · 0 评论 -
C# --- 浮点数类型 float, double, decimal
【代码】C# --- 浮点数类型 float, double, decimal。原创 2024-05-27 17:17:59 · 918 阅读 · 0 评论 -
C# --- Struct and Record
StructRecord原创 2023-08-20 20:26:51 · 1182 阅读 · 0 评论 -
C# --- Constructor, Object Initializer, Property, Constant, and readonly
Constructor and Object InitializerFields and Property如何设置常量原创 2023-07-10 17:24:51 · 594 阅读 · 0 评论 -
C# --- 类型安全 与 var关键字
什么是类型安全var关键字原创 2023-07-03 23:45:43 · 381 阅读 · 1 评论