|
8 | 8 | using System.Collections.Generic; |
9 | 9 | using System.Collections; |
10 | 10 |
|
11 | | -// Disable until we get around to enable + fix any issues. |
12 | | -#nullable disable |
| 11 | +#nullable enable |
13 | 12 |
|
14 | 13 | namespace Foundation { |
15 | | - public partial class NSDirectoryEnumerator : IEnumerator<NSString>, IEnumerator<string>, IEnumerator { |
16 | | - NSObject current; |
| 14 | + public partial class NSDirectoryEnumerator : IEnumerator<NSString?>, IEnumerator<string?>, IEnumerator { |
| 15 | + NSObject? current; |
17 | 16 |
|
18 | | - /// <summary>To be added.</summary> |
19 | | - /// <returns>To be added.</returns> |
20 | | - /// <remarks>To be added.</remarks> |
| 17 | + /// <summary>Advances the enumerator to the next element of the collection.</summary> |
| 18 | + /// <returns><see langword="true"/> if the enumerator was successfully advanced to the next element; <see langword="false"/> if the enumerator has passed the end of the collection.</returns> |
21 | 19 | bool IEnumerator.MoveNext () |
22 | 20 | { |
23 | 21 | current = NextObject (); |
24 | 22 | return current is not null; |
25 | 23 | } |
26 | 24 |
|
27 | | - /// <summary>To be added.</summary> |
28 | | - /// <remarks>To be added.</remarks> |
| 25 | + /// <summary>Sets the enumerator to its initial position, which is before the first element in the collection.</summary> |
| 26 | + /// <exception cref="InvalidOperationException">This operation is not supported for this enumerator.</exception> |
29 | 27 | void IEnumerator.Reset () |
30 | 28 | { |
31 | 29 | throw new InvalidOperationException (); |
32 | 30 | } |
33 | 31 |
|
34 | | - /// <summary>Gets the current element.</summary> |
35 | | - /// <value>The current element.</value> |
36 | | - string IEnumerator<string>.Current { |
| 32 | + /// <summary>Gets the current element as a <see cref="string"/>.</summary> |
| 33 | + /// <value>The current element as a <see cref="string"/>, or <see langword="null"/> if the enumerator is positioned before the first element or after the last element.</value> |
| 34 | + string? IEnumerator<string?>.Current { |
37 | 35 | get { |
38 | | - return current.ToString (); |
| 36 | + return current?.ToString (); |
39 | 37 | } |
40 | 38 | } |
41 | 39 |
|
42 | | - /// <summary>Gets the current element.</summary> |
43 | | - /// <value>The current element.</value> |
44 | | - NSString IEnumerator<NSString>.Current { |
| 40 | + /// <summary>Gets the current element as an <see cref="NSString"/>.</summary> |
| 41 | + /// <value>The current element as an <see cref="NSString"/>, or <see langword="null"/> if the enumerator is positioned before the first element or after the last element, or if the current element is not an <see cref="NSString"/>.</value> |
| 42 | + NSString? IEnumerator<NSString?>.Current { |
45 | 43 | get { |
46 | 44 | return current as NSString; |
47 | 45 | } |
48 | 46 | } |
49 | 47 |
|
50 | | - /// <summary>Gets the current element.</summary> |
51 | | - /// <value>The current element.</value> |
52 | | - /// <remarks>To be added.</remarks> |
| 48 | + /// <summary>Gets the current element in the collection.</summary> |
| 49 | + /// <value>The current element in the collection.</value> |
| 50 | + /// <exception cref="InvalidOperationException">The enumerator is positioned before the first element of the collection or after the last element.</exception> |
53 | 51 | object IEnumerator.Current { |
54 | 52 | get { |
| 53 | + if (current is null) |
| 54 | + throw new InvalidOperationException (); |
55 | 55 | return current; |
56 | 56 | } |
57 | 57 | } |
|
0 commit comments