@@ -24,8 +24,7 @@ class Attribute
2424 /// <param name="value">The value of the Attribute, which must be of a supported Datamodel type.</param>
2525 public Attribute ( string name , AttributeList owner , object value )
2626 {
27- if ( name == null )
28- throw new ArgumentNullException ( "name" ) ;
27+ ArgumentNullException . ThrowIfNull ( name ) ;
2928
3029 Name = name ;
3130 _Owner = owner ;
@@ -41,8 +40,7 @@ public Attribute(string name, AttributeList owner, object value)
4140 public Attribute ( string name , AttributeList owner , long defer_offset )
4241 : this ( name , owner , null )
4342 {
44- if ( owner == null )
45- throw new ArgumentNullException ( "owner" ) ;
43+ ArgumentNullException . ThrowIfNull ( owner ) ;
4644
4745 Offset = defer_offset ;
4846 }
@@ -379,7 +377,7 @@ public bool TryGetValue(string key, out object value)
379377
380378 public virtual bool ContainsKey ( string key )
381379 {
382- if ( key == null ) throw new ArgumentNullException ( " key" ) ;
380+ ArgumentNullException . ThrowIfNull ( key ) ;
383381 lock ( Attribute_ChangeLock )
384382 return Inner [ key ] != null ;
385383 }
@@ -406,14 +404,14 @@ public virtual object this[string name]
406404 {
407405 get
408406 {
409- if ( name == null ) throw new ArgumentNullException ( " name" ) ;
407+ ArgumentNullException . ThrowIfNull ( name ) ;
410408 var attr = ( Attribute ) Inner [ name ] ;
411409 if ( attr == null ) throw new KeyNotFoundException ( String . Format ( "{0} does not have an attribute called \" {1}\" " , this , name ) ) ;
412410 return attr . Value ;
413411 }
414412 set
415413 {
416- if ( name == null ) throw new ArgumentNullException ( " name" ) ;
414+ ArgumentNullException . ThrowIfNull ( name ) ;
417415 if ( value != null && ! Datamodel . IsDatamodelType ( value . GetType ( ) ) )
418416 throw new AttributeTypeException ( String . Format ( "{0} is not a valid Datamodel attribute type. (If this is an array, it must implement IList<T>)." , value . GetType ( ) . FullName ) ) ;
419417
0 commit comments