diff --git a/src/Foundation/NSDirectoryEnumerator.cs b/src/Foundation/NSDirectoryEnumerator.cs index 276d7924673b..3d2d01982101 100644 --- a/src/Foundation/NSDirectoryEnumerator.cs +++ b/src/Foundation/NSDirectoryEnumerator.cs @@ -8,50 +8,50 @@ using System.Collections.Generic; using System.Collections; -// Disable until we get around to enable + fix any issues. -#nullable disable +#nullable enable namespace Foundation { - public partial class NSDirectoryEnumerator : IEnumerator, IEnumerator, IEnumerator { - NSObject current; + public partial class NSDirectoryEnumerator : IEnumerator, IEnumerator, IEnumerator { + NSObject? current; - /// To be added. - /// To be added. - /// To be added. + /// Advances the enumerator to the next element of the collection. + /// if the enumerator was successfully advanced to the next element; if the enumerator has passed the end of the collection. bool IEnumerator.MoveNext () { current = NextObject (); return current is not null; } - /// To be added. - /// To be added. + /// Sets the enumerator to its initial position, which is before the first element in the collection. + /// This operation is not supported for this enumerator. void IEnumerator.Reset () { throw new InvalidOperationException (); } - /// Gets the current element. - /// The current element. - string IEnumerator.Current { + /// Gets the current element as a . + /// The current element as a , or if the enumerator is positioned before the first element or after the last element. + string? IEnumerator.Current { get { - return current.ToString (); + return current?.ToString (); } } - /// Gets the current element. - /// The current element. - NSString IEnumerator.Current { + /// Gets the current element as an . + /// The current element as an , or if the enumerator is positioned before the first element or after the last element, or if the current element is not an . + NSString? IEnumerator.Current { get { return current as NSString; } } - /// Gets the current element. - /// The current element. - /// To be added. + /// Gets the current element in the collection. + /// The current element in the collection. + /// The enumerator is positioned before the first element of the collection or after the last element. object IEnumerator.Current { get { + if (current is null) + throw new InvalidOperationException (); return current; } }