Friday, July 29, 2016

.NET collections - Language Integrate Query - LINQ study series (II)

July 29, 2016

More reading about LINQ:
Google search keywords:
1. basic code patterns used for LINQ
2. .NET collections

Notes from the above article:

LINQ queries 
in-memory objects
object type 
IEnumerable
IEnumerable<T>
object type implements IEnumberable or IEnumerable<T>

LINQ common pattern for accessing data vs standard foreach loops
more concise and readable 

LINQ 3 capabilities: 
filtering
ordering
grouping capabilities

LINQ 
improve performance

common variations of data collections:
hash tables, 
queues, 
stacks, 
bags   ? 
dictionaries
lists

3 Interfaces:
ICollection
IList
IDictionary
generic conterparts

ICollection -> IList
ICollection -> IDictionary

3 examples based on IList
Array
ArrayList
List<T>

4 examples based on ICollection - 1 value
Queue, 
ConcurrentQueue<T>
Stack
ConcurrentStack<T>
LinkedList<T>

5 examples based on IDictionary - 2 values, both a key and a value
Hashtable
SortedList
Dictionary<TKey,TValue>
SoretdList<TKey, TValue> 
ConcurrentDictionary<TKey, Tvalue> 

Special one - a list of values with keys embedded within the values and, therefore, it behaves like a list and like a dictionary
KeyedCollection<TKey,TItem> 

class vs generic classes ? 

Generic collections
strong typing
Ready for this - memorize the claim: Julia likes it - reading is quickest way to become an expert!
Generic collections are the best solution to strong typing

-- Julia likes strong typing, find problems in compile time, fix bugs in static analysis, no debugging/test cases' help
-- Design the function to less error prone - as simple as possible
-- do one task only

Facts? Look into google: 
some languages does not support generics - which one, not C#

behaviors:
how they are sorted
how searches are performed
how comparisons are made


No comments:

Post a Comment