Click here to Skip to main content
15,881,709 members
Home / Discussions / C#
   

C#

 
GeneralRe: How would you describe what an IEnumerable is to a bright student of C# Pin
Gerry Schmitz26-Jan-22 6:13
mveGerry Schmitz26-Jan-22 6:13 
GeneralRe: How would you describe what an IEnumerable is to a bright student of C# Pin
endo funk26-Jan-22 9:40
endo funk26-Jan-22 9:40 
GeneralRe: How would you describe what an IEnumerable is to a bright student of C# Pin
Gerry Schmitz27-Jan-22 16:58
mveGerry Schmitz27-Jan-22 16:58 
GeneralRe: How would you describe what an IEnumerable is to a bright student of C# Pin
endo funk27-Jan-22 19:35
endo funk27-Jan-22 19:35 
GeneralRe: How would you describe what an IEnumerable is to a bright student of C# Pin
Gerry Schmitz28-Jan-22 5:50
mveGerry Schmitz28-Jan-22 5:50 
GeneralRe: How would you describe what an IEnumerable is to a bright student of C# Pin
endo funk28-Jan-22 6:40
endo funk28-Jan-22 6:40 
GeneralRe: How would you describe what an IEnumerable is to a bright student of C# Pin
Gerry Schmitz28-Jan-22 7:29
mveGerry Schmitz28-Jan-22 7:29 
GeneralRe: How would you describe what an IEnumerable is to a bright student of C# Pin
endo funk28-Jan-22 8:46
endo funk28-Jan-22 8:46 
Nope... but I'm sure we can agree its become rather pedantic.

An interface on its own is not a state machine; whilst the outcome of this type of implementation:
C#
public class Id : IEnumerable {
    private readonly int Value;
    public Id(int value) => (Value) = (value);
    public IEnumerator GetEnumerator() {
      yield return Value;
    }
}
..technically yields a state machine; it does not make either IEnumerable or IEnumerator themselves a state machine... they're an implementation requirement.. but then (pedantically) we're getting into the weeds.

Plus this line of discussion has no bearing on the scope of the OP's question wrt to either:


...they've had no problems mastering 'Select and 'Where, 'Aggregate, etc.
What's so useful about deferred evaluation ?
why do I have to trigger iteration with 'Count() to see how many items it has...


In that context IEnumerable should not be considered without Linq; re Select and 'Where, 'Aggregate, etc. are a reference to Linq; and in that context it is the extension methods of Linq that bridge IEnumerable to Linq's implementation of a state machine, and similarly Count().

I also said...


Whilst its possible to create your own custom interfaces and types to tie in with Linq


It is not a requirement for custom Linq types to implement IEnumerable to use both syntactic styles of Linq. Nor would it be possible for product and sum types to conform to IEnumerable; because its an implementation that is tied to IEnumerator; an API designed for iterating over a collection.
GeneralRe: How would you describe what an IEnumerable is to a bright student of C# Pin
BillWoodruff26-Jan-22 23:52
professionalBillWoodruff26-Jan-22 23:52 
GeneralRe: How would you describe what an IEnumerable is to a bright student of C# Pin
BillWoodruff26-Jan-22 23:39
professionalBillWoodruff26-Jan-22 23:39 
GeneralRe: How would you describe what an IEnumerable is to a bright student of C# Pin
endo funk27-Jan-22 6:44
endo funk27-Jan-22 6:44 
GeneralRe: How would you describe what an IEnumerable is to a bright student of C# Pin
BillWoodruff27-Jan-22 23:44
professionalBillWoodruff27-Jan-22 23:44 
GeneralRe: How would you describe what an IEnumerable is to a bright student of C# Pin
endo funk28-Jan-22 2:11
endo funk28-Jan-22 2:11 
GeneralRe: How would you describe what an IEnumerable is to a bright student of C# Pin
jschell30-Jan-22 7:08
jschell30-Jan-22 7:08 
GeneralRe: How would you describe what an IEnumerable is to a bright student of C# Pin
endo funk30-Jan-22 14:22
endo funk30-Jan-22 14:22 
GeneralRe: How would you describe what an IEnumerable is to a bright student of C# Pin
jschell17-Feb-22 10:22
jschell17-Feb-22 10:22 
GeneralRe: How would you describe what an IEnumerable is to a bright student of C# Pin
endo funk17-Feb-22 14:22
endo funk17-Feb-22 14:22 
GeneralRe: How would you describe what an IEnumerable is to a bright student of C# Pin
jschell30-Jan-22 7:07
jschell30-Jan-22 7:07 
GeneralRe: How would you describe what an IEnumerable is to a bright student of C# Pin
jschell30-Jan-22 7:06
jschell30-Jan-22 7:06 
GeneralRe: How would you describe what an IEnumerable is to a bright student of C# Pin
endo funk30-Jan-22 14:21
endo funk30-Jan-22 14:21 
GeneralRe: How would you describe what an IEnumerable is to a bright student of C# Pin
jschell17-Feb-22 10:28
jschell17-Feb-22 10:28 
GeneralRe: How would you describe what an IEnumerable is to a bright student of C# Pin
endo funk17-Feb-22 14:38
endo funk17-Feb-22 14:38 
QuestionC# filter database through comboboxes Pin
R-Berg21-Jan-22 1:20
R-Berg21-Jan-22 1:20 
AnswerRe: C# filter database through comboboxes Pin
jsc4221-Jan-22 3:50
professionaljsc4221-Jan-22 3:50 
GeneralRe: C# filter database through comboboxes Pin
R-Berg21-Jan-22 5:59
R-Berg21-Jan-22 5:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.