在像OperationContext
一个复杂的对象是安全的写这样的代码:检查空的层次结构中的if语句
if(OperationContext.Current!=null &&
OperationContext.Current.ServiceSecurityContext !=null &&
OperationContext.Current.ServiceSecurityContext.WindowsIdentity !=null)
或者我需要到代码中分离到三个if
报表?
我的问题是如果OperationContext.Current
为空我恐怕OperationContext.Current.ServiceSecurityContext
会抛出NullReferenceException
。
什么是电路评估? –
@ilayzeidman我在我的回答中解释过。此外,我提供的链接将为您提供您需要了解的一切。 – James