ASP.NET Core学习日记20

1.富客户端应用程序线程底层实现
解析:
[1]WPF:在元素的Dispatcher对象上调用BeginInvoke或Invoke
[2]WinForm:调用空间的BeginInvoke或Invoke
[3]UWP:调用Dispatcher对象上的RunAsync或Invoke

2.未观察到的异常
解析:可以通过全局的TaskScheduler.UnobservedTaskException来订阅未观察到的异常。

3.Task组合器
解析:
[1]Task.WhenAny
[2]Task.WhenAll

4.同步线程活动和数据访问的类
解析:Mutex、Monitor、Interlocked、AutoResetEvent。
[1]AutoResetEvent:表示线程同步事件在一个等待线程释放后收到信号时自动重置。此类不能被继承。
[1]CancellationTokenSource:通知CancellationToken,告知其应被取消。
[2]Interlocked:为多个线程共享的变量提供原子操作。
[3]Monitor:提供同步访问对象的机制。
[4]Mutex:还可用于进程间同步的同步基元。
[5]ThreadLocal:提供数据的线程本地存储。
[6]Volatile:包含用于执行可变内存操作的方法。
[7]LockCookie:定义实现单个编写器/多个阅读器语义的锁。这是值类型。
[8]SpinLock:提供一个相互排斥锁基元,在该基元中,尝试获取锁的线程将在重复检查的循环中等待,直至该锁变为可用为止。
[9]SpinWait:为基于自旋的等待提供支持。
[10]TimerCallback:表示要由线程池线程执行的回调方法。
[11]WaitOrTimerCallback:表示当WaitHandle超时或终止时要调用的方法。

5.Rx
解析:响应式扩展。一种声明式的编程模式,程序在该模式中对事件作出响应。

6.IEnumerable、ICollection和IList
解析:
[1]如果只想遍历集合,使用IEnumerable,IEnumerable<T>
[2]如果想遍历、修改集合,以及需要延迟加载的导航属性,使用ICollection,ICollection<T>
[3]如果想遍历、修改、添加、清空、使用索引,使用IList,IList<T>

7.Parallel类和PLINQ区别
解析:PLINQ假设可以使用计算机内所有的CPU核,而Parallel类则会根据CPU状态的变化动态地调整。

8.xUnit.net特点
解析:
[1]为每个测试方法产生一个对象实例
[2]取消了[SetUp]和[TearDown]
[3]取消了[ExpectedException]
[4]类似于Aspect的功能
[5]减少了自定义属性[Attribute]的数目
[6]采用泛型
[7]匿名委托
[8]可扩展的断言
[9]可扩展的测试方法
[10]可扩展的测试类

9.Xunit.InlineDataAttribute.InlineDataAttribute(params object[] data)
解析:

10.ConcurrentDictionary
解析:线程安全的字典类。

11.lock(expression) embedded-statement(lock (表达式) 嵌入语句)
解析:
[1]lock语句用于获取某个给定对象的互斥锁,执行一个语句,然后释放该锁
[2]lock语句的表达式必须表示一个引用类型的值
[3]一个类的system.type对象可以方便地用来当作关于该类的静态方法的互斥锁
[4]lock语句本质使用的就是Monitor.Enter和Monitor.Exit
[5]lock不能锁定string类型,虽然它也是引用类型的

12.自定义授权策略
解析:自定义授权策略的实现,包括实现一个IAuthorizationRequirement的Requirement,和实现AuthorizationHandler<TRequirement>的处理器。

13.C#中的[Serializable]
解析:序列化就是把内存中对象以一种可以保存的形式保存起来。

14.ASP.Net Core Antiforgery
解析:ASP.NetCore包含一个名为Antiforgery的包,可用于保护网站免受CSRF攻击,该包实现了OWASP站点推荐的CSRF令牌机制。

15.Microsoft.AspNetCore.Identity.IdentityOptions.Password
解析:Gets or sets the PasswordOptions for the identity system.

16.Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerDefaults
解析:Default values used by bearer authentication.

17.Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerOptions.TokenValidationParameters
解析:
[1]Gets or sets the parameters used to validate identity tokens.
[2]Contains the types and definitions required for validating a token.

18.Microsoft.AspNetCore.Antiforgery.AntiforgeryOptions.HeaderName
解析:Specifies the name of the header value that is used by the antiforgery system. If null then antiforgery validation will only consider form data.

19.Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerOptions
解析:Provides programmatic configuration of Kestrel-specific features.

20.Microsoft.AspNetCore.Mvc.MvcNewtonsoftJsonOptions.SerializerSettings
解析:Gets the JsonSerializerSettings that are used by this application.

21.Newtonsoft.Json.ReferenceLoopHandling
解析:Specifies reference loop handling options for the JsonSerializer.

22.Newtonsoft.Json.DateFormatHandling
解析:Specifies how dates are formatted when writing JSON text.

23.IMvcBuilder Microsoft.Extensions.DependencyInjection.MvcServiceCollectionExtensions.AddControllers(this IServiceCollection services)
解析:Adds services for controllers to the specified IServiceCollection. This method will not register services used for views or pages.

24.IMvcBuilder Microsoft.Extensions.DependencyInjection.MvcCoreMvcBuilderExtensions.AddApplicationPart(this IMvcBuilder builder, Assembly assembly)
解析:Adds an ApplicationPart to the list of ApplicationParts on the PartManager.

25.System.Type.Assembly
解析:Gets the Assembly in which the type is declared. For generic types, gets the Assembly in which the generic type is defined.

参考文献:
[1]《xUnit Test Patterns》学习笔记系列:https://www.cnblogs.com/coderzh/archive/2010/01/23/xUnit-Test-Patterns.html
[2]在ASP.NET Core Web程序中使用Antiforgery防御CSRF:https://www.cnblogs.com/zhesong/articles/csrfanti.html

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

NLP工程化

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值