Skip to main content
deleted 3 characters in body
Source Link
Joel Coehoorn
  • 1.9k
  • 4
  • 17
  • 22

Many other platforms have an array constructconstructs of some kind which isare in fact NOT an arrayarrays, at least in the formal computer science sense, because it violates one (and usually both) of those features (though they will often paper over the latter). Rather, the platforms offer a collection with the "array" name merely attached to it.

In most cases, we should be using IEnumerable<T> instead of List<T>. IQueryable<T> and (more recently) IAsyncEnumerable<T> are also good options. In any case, from here we either skip the .ToList() call or use ana yield iterator instead of instantiating a list and adding records. Again, this allows us to set up data processing systems that stream data one record at a time, rather than materializing entire result sets as usually happens today. This could dramatically improve memory use (for I hope obvious reasons) and initial response times (because we can start streaming data as we receive the first record, instead of waiting for the last record to be added to a list).

Many other platforms have an array construct of some kind which is in fact NOT an array, at least in the formal computer science sense, because it violates one (and usually both) of those features (though they will often paper over the latter). Rather, the platforms offer a collection with the "array" name merely attached to it.

In most cases, we should be using IEnumerable<T> instead of List<T>. IQueryable<T> and (more recently) IAsyncEnumerable<T> are also good options. In any case, from here we either skip the .ToList() call or use an iterator instead of instantiating a list and adding records. Again, this allows us to set up data processing systems that stream data one record at a time, rather than materializing entire result sets as usually happens today. This could dramatically improve memory use (for I hope obvious reasons) and initial response times (because we can start streaming data as we receive the first record, instead of waiting for the last record to be added to a list).

Many other platforms have array constructs of some kind which are in fact NOT arrays, at least in the formal computer science sense, because it violates one (and usually both) of those features (though they will often paper over the latter). Rather, the platforms offer a collection with the "array" name merely attached to it.

In most cases, we should be using IEnumerable<T> instead of List<T>. IQueryable<T> and (more recently) IAsyncEnumerable<T> are also good options. In any case, from here we either skip the .ToList() call or use a yield iterator instead of instantiating a list and adding records. Again, this allows us to set up data processing systems that stream data one record at a time, rather than materializing entire result sets as usually happens today. This could dramatically improve memory use (for I hope obvious reasons) and initial response times (because we can start streaming data as we receive the first record, instead of waiting for the last record to be added to a list).

added 45 characters in body
Source Link
Joel Coehoorn
  • 1.9k
  • 4
  • 17
  • 22

This should be enough now to understand why the practice you observed for C# is the way it is, or at least why array is not commonly chosen.

This should be enough now to understand why the practice you observed for C# is the way it is.

This should be enough now to understand why the practice you observed for C# is the way it is, or at least why array is not commonly chosen.

added 97 characters in body
Source Link
Joel Coehoorn
  • 1.9k
  • 4
  • 17
  • 22

In most cases, we should be using IEnumerable<T> instead of List<T>,. IQueryable<T> and (more recently) IAsyncEnumerable<T> are also good options. In any case, from here we either skippingskip the .ToList() call or usinguse an iterator instead of instantiating a list and adding records. Again, this would allowallows us to set up data processing systems that stream data one record at a time, rather than materializing entire result sets as usually happens today. This could dramatically improve memory use (for I hope obvious reasons) and initial response times (because we can start streaming data as we receive the first record, instead of waiting for the last record to be added to a list).

 

This also displays the weakness of my argument that individual collection types are a strength: the various types are only a strength to the degree programmers understand them and make good choices. In practice, we often still fall back to a baseline List<T> collection, whether or not it's really the right option.

In most cases, we should be using IEnumerable<T> instead of List<T>, and either skipping the .ToList() call or using an iterator instead of instantiating a list and adding records. Again, this would allow us to set up data processing systems that stream data one record at a time, rather than materializing entire result sets as usually happens today. This could dramatically improve memory use (for I hope obvious reasons) and initial response times (because we can start streaming data as we receive the first record, instead of waiting for the last record to be added to a list).

This also displays the weakness of my argument that individual collection types are a strength: the types are only a strength to the degree programmers understand them and make good choices. In practice, we often still fall back to a baseline List<T> collection, whether or not it's really the right option.

In most cases, we should be using IEnumerable<T> instead of List<T>. IQueryable<T> and (more recently) IAsyncEnumerable<T> are also good options. In any case, from here we either skip the .ToList() call or use an iterator instead of instantiating a list and adding records. Again, this allows us to set up data processing systems that stream data one record at a time, rather than materializing entire result sets as usually happens today. This could dramatically improve memory use (for I hope obvious reasons) and initial response times (because we can start streaming data as we receive the first record, instead of waiting for the last record to be added to a list).

 

This also displays the weakness of my argument that individual collection types are a strength: the various types are only a strength to the degree programmers understand them and make good choices. In practice, we often still fall back to a baseline List<T> collection, whether or not it's really the right option.

deleted 3 characters in body
Source Link
Joel Coehoorn
  • 1.9k
  • 4
  • 17
  • 22
Loading
deleted 3 characters in body
Source Link
Joel Coehoorn
  • 1.9k
  • 4
  • 17
  • 22
Loading
deleted 13 characters in body
Source Link
Joel Coehoorn
  • 1.9k
  • 4
  • 17
  • 22
Loading
added 22 characters in body
Source Link
Joel Coehoorn
  • 1.9k
  • 4
  • 17
  • 22
Loading
added 235 characters in body
Source Link
Joel Coehoorn
  • 1.9k
  • 4
  • 17
  • 22
Loading
added 409 characters in body
Source Link
Joel Coehoorn
  • 1.9k
  • 4
  • 17
  • 22
Loading
added 572 characters in body
Source Link
Joel Coehoorn
  • 1.9k
  • 4
  • 17
  • 22
Loading
added 572 characters in body
Source Link
Joel Coehoorn
  • 1.9k
  • 4
  • 17
  • 22
Loading
Source Link
Joel Coehoorn
  • 1.9k
  • 4
  • 17
  • 22
Loading