C#12中的Collection expressions(集合表达式语法糖)
摘要:C#12中引入了新的语法糖来创建常见的集合。并且可以使用..来解构集合,将其内联到另一个集合中。 支持的类型 数组类型,例如 int[]。 System.Span<T> 和 System.ReadOnlySpan<T>。 支持常见泛型集合,例如 System.Collections.Generic.
阅读全文
posted @
2023-11-20 10:24
chester·chen
阅读(2544)
推荐(9)
.NET8 Blazor新特性 流式渲染
摘要:什么是SSR Blazor中的流式渲染结合了SSR(服务端渲染),服务端将HTML拼好返回给前端,有点像我们熟知的Razor Pages 或 MVC 。 当已经有了 Razor Pages 或 MVC 时,为什么还要选择使用 Blazor 来实现这一点?这里有几个原因。 首先,Razor Pages
阅读全文
posted @
2023-11-19 07:56
chester·chen
阅读(3299)
推荐(12)
.NET8 Blazor的Auto渲染模式的初体验
摘要:.NET8发布后,Blazor支持四种渲染方式 静态渲染,这种页面只可显示,不提供交互,可用于网页内容展示 使用Blazor Server托管的通过Server交互方式 使用WebAssembly托管的在浏览器端交互方式 使用Auto自动交互方式,最初使用 Blazor Server,并在随后访问时
阅读全文
posted @
2023-11-18 07:44
chester·chen
阅读(4226)
推荐(8)
C#12中的Primary Constructors(主构造函数)
摘要:什么是主构造函数 把参数添加到class与record的类声明中就是主构造函数。例如 class Person(string name) { private string _name = name; } 这种写法与以下代码写法一样 class Person { private string _nam
阅读全文
posted @
2023-11-17 08:08
chester·chen
阅读(1927)
推荐(8)
.NET8依赖注入新特性Keyed services
摘要:什么是Keyed service Keyed service是指,为一个需要注入的服务定义一个Key Name,并使用使用Key Name检索依赖项注入 (DI) 服务的机制。 使用方法 通过调用 AddKeyedSingleton (或 AddKeyedScoped 或 AddKeyedTrans
阅读全文
posted @
2023-11-16 10:05
chester·chen
阅读(2139)
推荐(7)