Skip to content

Commit ee17522

Browse files
committed
Style and latest language
1 parent 692290c commit ee17522

11 files changed

Lines changed: 405 additions & 472 deletions

File tree

Arrays.cs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,15 @@ public DebugView(Array<T> arr)
3333

3434
public virtual AttributeList Owner
3535
{
36-
get { return _Owner; }
37-
internal set { _Owner = value; OnPropertyChanged(); }
36+
get => _Owner;
37+
internal set
38+
{
39+
_Owner = value; OnPropertyChanged();
40+
}
3841
}
3942
AttributeList _Owner;
4043

41-
protected Datamodel OwnerDatamodel { get { return Owner == null ? null : Owner.Owner; } }
44+
protected Datamodel OwnerDatamodel => Owner?.Owner;
4245

4346
internal Array()
4447
{
@@ -353,10 +356,7 @@ public ElementArray(int capacity)
353356

354357
public override AttributeList Owner
355358
{
356-
get
357-
{
358-
return base.Owner;
359-
}
359+
get => base.Owner;
360360
internal set
361361
{
362362
RWLock.EnterUpgradeableReadLock();
@@ -439,10 +439,7 @@ public override Element this[int index]
439439
RWLock.ExitUpgradeableReadLock();
440440
}
441441
}
442-
set
443-
{
444-
base[index] = value;
445-
}
442+
set => base[index] = value;
446443
}
447444
}
448445

Attributes.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)