@@ -34,7 +34,7 @@ public XmlElementContext(XmlElementContext? parent, XmlElement element, XmlDocum
3434
3535 public T ? GetService < T > ( ) where T : class
3636 {
37- if ( _serviceProvider != null )
37+ if ( _serviceProvider is not null )
3838 {
3939 // note it is legal to return service that's null -- due to SetTokenizeAttributeStorage
4040 return _serviceProvider . GetService ( typeof ( T ) ) as T ;
@@ -74,7 +74,7 @@ string ConstructXPath()
7474 {
7575 try
7676 {
77- string parentPath = _parentContext == null ? string . Empty : _parentContext . XPath ;
77+ string parentPath = _parentContext is null ? string . Empty : _parentContext . XPath ;
7878
7979 Locator locator = CreateLocator ( out string ? argumentString ) ;
8080
@@ -90,7 +90,7 @@ string ConstructParentXPath()
9090 {
9191 try
9292 {
93- string parentPath = _parentContext == null ? string . Empty : _parentContext . XPath ;
93+ string parentPath = _parentContext is null ? string . Empty : _parentContext . XPath ;
9494
9595 Locator locator = CreateLocator ( out string ? argumentString ) ;
9696
@@ -105,7 +105,7 @@ string ConstructParentXPath()
105105 Locator CreateLocator ( out string ? argumentString )
106106 {
107107 var locator = CreateObjectFromAttribute < Locator > ( out argumentString , out _locatorAttribute ) ;
108- if ( locator == null )
108+ if ( locator is null )
109109 {
110110 argumentString = null ;
111111 //avoid using singleton of "DefaultLocator.Instance", so unit tests can run parallel
@@ -122,7 +122,7 @@ internal XmlNodeList TargetParents
122122 {
123123 get
124124 {
125- if ( _targetParents == null && _parentContext != null )
125+ if ( _targetParents is null && _parentContext is not null )
126126 _targetParents = GetTargetNodes ( ParentXPath ) ;
127127 return _targetParents ! ;
128128 }
@@ -135,7 +135,7 @@ XmlNode CreateCloneInTargetDocument(XmlNode? sourceNode)
135135 var infoDocument = TargetDocument as XmlFileInfoDocument ;
136136 XmlNode clonedNode ;
137137
138- if ( infoDocument != null )
138+ if ( infoDocument is not null )
139139 clonedNode = infoDocument . CloneNodeFromOtherDocument ( sourceNode ) ;
140140 else
141141 {
@@ -150,7 +150,7 @@ XmlNode CreateCloneInTargetDocument(XmlNode? sourceNode)
150150
151151 static void ScrubTransformAttributesAndNamespaces ( XmlNode node )
152152 {
153- if ( node . Attributes != null )
153+ if ( node . Attributes is not null )
154154 {
155155 var attributesToRemove = new List < XmlAttribute > ( ) ;
156156
@@ -181,7 +181,7 @@ static void ScrubTransformAttributesAndNamespaces(XmlNode node)
181181
182182 XmlNamespaceManager GetNamespaceManager ( )
183183 {
184- if ( _namespaceManager == null )
184+ if ( _namespaceManager is null )
185185 {
186186 XmlNodeList localNamespaces = Element ! . SelectNodes ( "namespace::*" ) ;
187187
@@ -206,7 +206,7 @@ XmlNamespaceManager GetNamespaceManager()
206206 }
207207
208208 XmlNameTable ? GetParentNameTable ( )
209- => _parentContext == null ? Element ? . OwnerDocument ? . NameTable : _parentContext . GetNamespaceManager ( ) . NameTable ;
209+ => _parentContext is null ? Element ? . OwnerDocument ? . NameTable : _parentContext . GetNamespaceManager ( ) . NameTable ;
210210
211211 static Regex ? _nameAndArgumentsRegex ;
212212 static Regex NameAndArgumentsRegex => _nameAndArgumentsRegex ??= new Regex ( @"\A\s*(?<name>\w+)(\s*\((?<arguments>.*)\))?\s*\Z" , RegexOptions . Compiled | RegexOptions . Singleline ) ;
@@ -236,7 +236,7 @@ static string ParseNameAndArguments(string name, out string? arguments)
236236 objectAttribute = Element ? . Attributes . GetNamedItem ( typeof ( TObjectType ) . Name , XmlTransformation . TransformNamespace ) as XmlAttribute ;
237237 try
238238 {
239- if ( objectAttribute != null )
239+ if ( objectAttribute is not null )
240240 {
241241 string typeName = ParseNameAndArguments ( objectAttribute . Value , out argumentString ) ;
242242 if ( ! string . IsNullOrEmpty ( typeName ) )
@@ -260,7 +260,7 @@ internal bool HasTargetNode(out XmlElementContext? failedContext, out bool exist
260260 if ( TargetNodes . Count == 0 )
261261 {
262262 failedContext = this ;
263- while ( failedContext . _parentContext != null && failedContext . _parentContext . TargetNodes . Count == 0 )
263+ while ( failedContext . _parentContext is not null && failedContext . _parentContext . TargetNodes . Count == 0 )
264264 failedContext = failedContext . _parentContext ;
265265
266266 existedInOriginal = ExistedInOriginal ( failedContext . XPath ) ;
@@ -292,7 +292,7 @@ bool ExistedInOriginal(string xpath)
292292 {
293293 var service = GetService < IXmlOriginalDocumentService > ( ) ;
294294 XmlNodeList ? nodeList = service ? . SelectNodes ( xpath , GetNamespaceManager ( ) ) ;
295- return nodeList != null && nodeList . Count > 0 ;
295+ return nodeList is not null && nodeList . Count > 0 ;
296296 }
297297 }
298298}
0 commit comments