博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
C# 调用线程并行上下文穿透-ILogicalThreadAffinative+CallContext
阅读量:4648 次
发布时间:2019-06-09

本文共 1840 字,大约阅读时间需要 6 分钟。

na mespace System.Runtime.Remoting.Messaging{	/// Provides a set of properties that are carried with the execution code path. This class cannot be inherited.	// Token: 0x0200085D RID: 2141	[SecurityCritical]	[ComVisible(true)]	[Serializable]	public sealed class CallContext		/// Stores a given object and associates it with the specified name.		/// The name with which to associate the new item in the call context. 		/// The object to store in the call context. 		/// 
The immediate caller does not have infrastructure permission.
// Token: 0x06005B36 RID: 23350 RVA: 0x0013EAFC File Offset: 0x0013CCFC [SecurityCritical] public static void SetData(string name, object data) { if (data is ILogicalThreadAffinative) { CallContext.LogicalSetData(name, data); return; } ExecutionContext mutableExecutionContext = Thread.CurrentThread.GetMutableExecutionContext(); mutableExecutionContext.LogicalCallContext.FreeNamedDataSlot(name); mutableExecutionContext.IllogicalCallContext.SetData(name, data); } /// Stores a given object in the logical call context and associates it with the specified name. /// The name with which to associate the new item in the logical call context. /// The object to store in the logical call context, this object must be serializable. ///
The immediate caller does not have infrastructure permission.
// Token: 0x06005B37 RID: 23351 RVA: 0x0013EB40 File Offset: 0x0013CD40 [SecurityCritical] public static void LogicalSetData(string name, object data) { ExecutionContext mutableExecutionContext = Thread.CurrentThread.GetMutableExecutionContext(); mutableExecutionContext.IllogicalCallContext.FreeNamedDataSlot(name); mutableExecutionContext.LogicalCallContext.SetData(name, data); }

  

转载于:https://www.cnblogs.com/micro-chen/p/10297503.html

你可能感兴趣的文章
ArcEngine开发之自定义工具
查看>>
SQL视频总结
查看>>
P4878 道路修建-美国
查看>>
dp练习
查看>>
vim
查看>>
苹果电脑包管理
查看>>
maze_travel的隐私声明
查看>>
对正则表达式又重新学了一遍,笔记方便以后查阅
查看>>
NSArray和NSString的联合使用
查看>>
UIKit应用 - Swift 版本: 3.让UITableViewCell的背景色渐变
查看>>
Java反射
查看>>
building tool
查看>>
JS中for循环输出三角形
查看>>
字节对齐2
查看>>
kafka幂等producer
查看>>
与Win8之磁盘活动时间100%斗争心得
查看>>
Matrix: android 中的Matrix (android.graphics.Matrix) (转)
查看>>
Android中处理崩溃异常
查看>>
Day7—socket进阶
查看>>
只读数据文件损坏恢复
查看>>