提交 3e3bb58b 编写于 作者: C Cyrus Najmabadi

Simplify null checks

上级 db4b3b4c
......@@ -78,9 +78,7 @@ internal CodeModelProjectCache(IThreadingContext threadingContext, ProjectId pro
{
var cacheEntry = GetCacheEntry(filePath);
return cacheEntry != null
? cacheEntry.Value.ComHandle
: null;
return cacheEntry?.ComHandle;
}
public ComHandle<EnvDTE80.FileCodeModel2, FileCodeModel> GetOrCreateFileCodeModel(string filePath, object parent)
......
......@@ -588,9 +588,7 @@ internal EnvDTE.CodeElement CodeElementFromPosition(int position, EnvDTE.vsCMEle
}
}
var node = parent != null
? parent.AncestorsAndSelf().FirstOrDefault(n => CodeModelService.MatchesScope(n, scope))
: null;
var node = parent?.AncestorsAndSelf().FirstOrDefault(n => CodeModelService.MatchesScope(n, scope));
if (node == null)
{
......
......@@ -74,15 +74,7 @@ public override EnvDTE.vsCMElement Kind
get { return EnvDTE.vsCMElement.vsCMElementAttribute; }
}
public override object Parent
{
get
{
return _parent != null
? _parent
: (object)this.FileCodeModel;
}
}
public override object Parent => _parent ?? (object)this.FileCodeModel;
public EnvDTE.CodeElements Arguments
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册