S
Stan Huang at Taiwan
Guest
See below snippet of C# program. I know how to use 'Current' in statement "public ExtractInfo Current" well, but I don't understand the other statement "object global::System.Collections.IEnumerator.Current". What does it mean? How to use it at upper applications which use this class?
public sealed class ExtractInfoArrayEnumerator : global::System.Collections.IEnumerator
, global::System.Collections.Generic.IEnumerator<ExtractInfo>
{
private ExtractInfoArray collectionRef;
.....
public ExtractInfoArrayEnumerator(ExtractInfoArray collection) {
collectionRef = collection;
...
}
// Type-safe iterator Current
public ExtractInfo Current {
get {
if (currentIndex == -1)
throw new global::System.InvalidOperationException("Enumeration not started.");
....
return (ExtractInfo)currentObject;
}
}
// Type-unsafe IEnumerator.Current
object global::System.Collections.IEnumerator.Current {
get {
return Current;
}
}
...
}
Continue reading...
public sealed class ExtractInfoArrayEnumerator : global::System.Collections.IEnumerator
, global::System.Collections.Generic.IEnumerator<ExtractInfo>
{
private ExtractInfoArray collectionRef;
.....
public ExtractInfoArrayEnumerator(ExtractInfoArray collection) {
collectionRef = collection;
...
}
// Type-safe iterator Current
public ExtractInfo Current {
get {
if (currentIndex == -1)
throw new global::System.InvalidOperationException("Enumeration not started.");
....
return (ExtractInfo)currentObject;
}
}
// Type-unsafe IEnumerator.Current
object global::System.Collections.IEnumerator.Current {
get {
return Current;
}
}
...
}
Continue reading...