KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
static void Main(string[] args) { List<int> listArray = new List<int>(); listArray.Add(100); foreach (int item in listArray) Console.WriteLine(item); } a) When foreach statement calls listArray's IEnumerable<int>.GetEnumerator() implementation, does it call it via listArray.GetEnumerator() or IEnumerable<int>.GetEnumerator() or IEnumerable.GetEnumerator() ? b) Similarly, when foreach references object returned by listArray's IEnumerable<int>.GetEnumerator() , does it reference this object via IEnumerator or IEnumerator<int> reference type? thank you EDIT: Some of my questions will quote this text: o Perform member lookup on the type X with identifier GetEnumerator and no type arguments. If the member lookup does not produce a match, or it produces an ambiguity, or produces a match that is not a method group, check for an enumerable interface as described below. It is recommended that a warning be issued if member lookup produces anything except a method group or no match. o Perform overload resolution using the resulting method group and an empty argument list. If overload resolution results in no applicable methods, results in an ambiguity, or results in a single best method but that method is either static or not public, check for an enumerable interface as described below. It is recommended that a warning be issued if overload resolution produces anything except an unambiguous public instance method or no applicable methods. o If the return type E of the GetEnumerator method is not a class, struct or interface type, an error is produced and no further steps are taken. o Member l
Tags (comma-separated)
Save Edits
Cancel