Functional Programming and LINQ via C#

[Latest version: https://weblogs.asp.net/dixin/linq-via-csharp]

Keywords

C#, .NET Core, Azure, Functional Programming, Lambda Calculus, Category Theory, LINQ, LINQ to Objects, LINQ to XML, Parallel LINQ, LINQ to Entities, Entity Framework Core, Azure SQL Database.

Abstract

This is a latest, in-depth, cross-platform book on functional programming and LINQ programming via C# language. It discusses:

  • Elegant functional programming via C#
  • Use functional LINQ to work with local data, and cloud data in Azure SQL Database
  • The internal implementation and underlying mathematics theories

    Contents at a Glance

    The contents are organized as the following chapters:

    • Part 1 Code - covers functional programming via C#, and fundamentals of LINQ.
      • Chapter 1 Functional programming and LINQ paradigm
        • What is LINQ, how LINQ uses language to work with many different data domains.
        • Programming paradigm, imperative vs. declarative programming, object-oriented vs. functional programming.
      • Chapter 2 Functional programming in depth
        • C# fundamentals for beginners.
        • Aspects of functional programming via C#, including function type, named/anonymous/local function, closure, lambda, higher-order function, currying, partial application, first class function, function composition, query expression, covariance/contravariance, immutability, tuple, purity, async function, pattern matching, etc., including how C# is processed at compile time and runtime.
    • Part 2 Data - covers how to use functional LINQ to work with different data domains in the real world, and how LINQ works internally.
      • Chapter 3 LINQ to Objects
        • How to use functional LINQ queries to work with objects, covering all LINQ and Ix.
        • How the LINQ to Objects query methods are implemented, how to implement useful custom LINQ queries.
      • Chapter 4 LINQ to XML
        • How to modeling XML data, and use functional LINQ queries to work with XML data.
        • How to use the other LINQ to XML APIs to manipulate XML data.
      • Chapter 5 Parallel LINQ
        • How to use parallelized functional LINQ queries to work with objects.
        • Performance analysis for parallel/sequential LINQ queries.
      • Chapter 6 Entity Framework/Core and LINQ to Entities
        • How to model database with object-relational mapping, and use functional LINQ queries to work with relational data in database.
        • How the C# LINQ to Entities queries are implemented to work with database.
        • How to change data in database, and handle concurrent conflicts.
        • Performance tips and asynchrony.
    • Part 3 Theories - demystifies the abstract mathematics theories, which are the rationale and foundations of LINQ and functional programming.
      • Chapter 7 Lambda Calculus via C#
        • Core concepts of lambda calculus, bound and free variables, reduction (α-conversion, β-reduction, η-conversion), etc.
        • How to use lambda functions to represent values, data structures and computation, including Church Boolean, Church numbers, Church pair, Church list, and their operations.
        • Combinators and combinatory logic, including SKI combinator calculus, fixed point combinator for function recursion, etc.
      • Chapter 8 Category Theory via C#
        • Core concepts of category theory, including category, object, morphism, monoid, functor, natural transformation, applicative functor, monad, and their laws.
        • How these concepts are applied in functional programming and LINQ.
        • How to manage I/O, state, exception handling, shared environment, logging, and continuation, etc., in functional programming.

    This tutorial delivers highly reusable knowledge:

    • It covers C# language in depth, which can be generally applied in any programming paradigms besides functional programming.
    • It is a cross platform tutorial, covering both .NET Framework for Windows and .NET Core for Windows, Mac, Linux.
    • It demonstrates both usage and implementation of LINQ for mainstream data domains, which also enables developer to use the LINQ technologies for other data domains, or build custom LINQ APIs for specific data scenarios.
    • It also demystifies the abstract mathematics knowledge for functional programming, which applies to general functional programming, so it greatly helps developers understanding any other functional languages too.

    As a fun of functional programming, LINQ, C#, and .NET technologies, hope this helps.

    Table of Contents

    All code examples are available on GitHub: https://github.com/Dixin/CodeSnippets.

    1. Functional programming and LINQ paradigm

      1. Getting started with .NET/Core, C# and LINQ

        • Cross platform .NET, C# and LINQ
          • .NET Framework
          • Parallel LINQ
          • .NET Core, UWP, Mono, Xamarin and Unity
          • .NET Standard
          • C# functional programming
        • This tutorial
        • Author
        • Code examples
        • Start coding
          • Start coding with Visual Studio (Windows)
          • Start coding with Visual Studio Code (Windows, macOS and Linux)
          • Start coding with Visual Studio for Mac (macOS)
      2. Programming paradigms and functional programming

        • Programming paradigms
        • Imperative programming vs. declarative programming
        • Object-oriented programming vs. functional programming
      3. LINQ Overview

        • One language for different data domains
          • LINQ to Objects
          • Parallel LINQ
          • LINQ to XML
          • LINQ to DataSets
          • LINQ to Entities
          • LINQ to SQL
          • LINQ to NoSQL (LINQ to CosmosDB)
          • LINQ to JSON
          • LINQ to Twitter
        • Productivity
        • Local query vs. remote query
    2. Functional programming in-depth

      1. C# language fundamentals

        • Types and members
          • Built-in types
        • Reference type vs. value type
          • default literal expression
          • ref structure
        • Static class
        • Partial type
        • Interface and implementation
          • IDisposable interface and using statement
        • Generic type
          • Type parameter
          • Type parameter constraints
        • Nullable value type
        • Auto property
        • Property initializer
        • Object initializer
        • Collection initializer
        • Index initializer
        • Null coalescing operator
        • Null conditional operator
        • throw expression
        • Exception filter
        • String interpolation
        • nameof operator
        • Digit separator and leading underscore
      2. Named Function and function polymorphism

        • Constructor, static constructor and finalizer
        • Static method and instance method
        • Extension method
        • More named functions
        • Function polymorphisms
          • Ad hoc polymorphism: method overload
          • Parametric polymorphism: generic method
            • Type argument inference
        • Static import
        • Partial method
      3. Local function and closure

        • Local function
        • Closure
          • Outer variable
          • Implicit reference
      4. Function input and output

        • Pass by value vs. pass by reference (ref parameter)
          • Pass by read only reference (in parameter)
        • Output parameter (out parameter) and out variable
        • Parameter array
        • Positional argument vs. named argument
        • Required parameter vs. optional parameter
        • Caller information parameter
        • Return by value vs. return by reference
          • Return by read only reference
      5. Delegate: function type, instance, and group

        • Delegate type as function type
          • Function type
          • Generic delegate type
          • Unified built-in delegate types
        • Delegate instance as function instance
          • Delegate class and delegate instance
        • Delegate instance as function group
          • Event and event handler
      6. Anonymous function and lambda expression

        • Anonymous method
        • Lambda expression
        • Call anonymous function
        • Closure
        • Expression bodied function member
      7. Expression tree: Function as data

        • Lambda expression as expression tree
          • Code as data
          • .NET expressions
        • Compile expression tree at runtime
          • Traverse expression tree
          • Expression tree to CIL at runtime
          • Expression tree to executable function at runtime
        • Expression tree and LINQ remote query
      8. Higher-order function, currying and first class function

        • First order and higher-order function
        • Curry function
        • => associativity
        • Partial apply function
        • Uncurry function
        • First-class function
      9. Function composition and chaining

        • Forward and backward composition
        • Forward pipe
        • Fluent chaining
          • Fluent extension methods
        • LINQ query method composition
      10. LINQ query Expression

        • Syntax and compilation
        • Query expression pattern
        • LINQ query expression
        • Query expression vs. query method
      11. Covariance and contravariance

        • Non-generic function type
        • Generic function type
        • Generic interface
        • Generic higher-order function type
        • Array
        • Variances in .NET and LINQ
      12. Immutability, anonymous type and tuple

        • Immutable value
          • Constant
          • using statement and foreach statement
          • this reference for class
          • Function’s readonly parameter and readonly return
          • Local variable by readonly reference (ref readonly variable)
          • Immutable value in LINQ query expression
        • Immutable state (immutable data type)
          • Type with constant field
          • Immutable class with readonly instance field
          • Immutable structure (readonly structure)
          • Immutable anonymous type
          • Immutable tuple vs. mutable tuple
            • Construction and element name
            • Deconstruction
            • Tuple assignment
          • Immutable collection vs. readonly collection
      13. Pure function

        • Referential transparency and side effect free
        • PureAttribute and code contracts
        • Purity in .NET
      14. Asynchronous function

        • Task, Task<TResult> and asynchrony
        • Named async function
        • Awaitable-awaiter pattern
        • Async state machine
        • Generalized async return type and async method builder
          • ValueTask<TResult> and performance
        • Runtime context capture
        • Anonymous async function
      15. Pattern matching

        • Is expression
        • Switch statement
    3. LINQ to Objects: Querying objects in memory

      1. Local Sequential LINQ query

        • Iteration pattern and foreach statement
        • IEnumerable<T> and IEnumerator<T>
          • EnumerableAssert utility
          • foreach loop vs. for loop
          • Non-generic sequence vs. generic sequence
        • LINQ to Objects queryable types
      2. LINQ to Objects standard queries and query expressions

        • Return a new IEnumerable<T> sequence
          • Generation: Empty , Range, Repeat, DefaultIfEmpty
          • Filtering (restriction): Where, OfType, where
          • Mapping (projection): Select, SelectMany, from, let, select
          • Grouping: GroupBy, group, by, into
          • Join
            • Inner join: Join, SelectMany, join, on, equals
            • Outer join: GroupJoin, join, into, on, equals
            • Cross join: SelectMany, Join, from select, join, on, equals
          • Concatenation: Concat
          • Set: Distinct, Union, Intersect, Except
          • Convolution: Zip
          • Partitioning: Take, Skip, TakeWhile, SkipWhile
          • Ordering: OrderBy, ThenBy, OrderByDescending, ThenByDescending, Reverse, orderby, ascending, descending, into
          • Conversion: Cast, AsEnumerable
        • Return a new collection
          • Conversion: ToArray, ToList, ToDictionary, ToLookup
        • Return a single value
          • Element: First, FirstOrDefault, Last, LastOrDefault, ElementAt, ElementAtOrDefault, Single, SingleOrDefault
          • Aggregation: Aggregate, Count, LongCount, Min, Max, Sum, Average
          • Quantifier: All, Any, Contains
          • Equality: SequenceEqual
        • Queries in other languages
      3. Generator

        • Implement iterator pattern
        • Generate sequence and iterator
        • Yield statement and generator
        • Iterator and generator in other languages
      4. Deferred execution, lazy evaluation and eager Evaluation

        • Deferred execution vs. immediate execution
          • Cold IEnumerable<T> vs. hot IEnumerable<T>
        • Lazy evaluation vs. eager evaluation
      5. LINQ to Objects internals: Standard queries implementation

        • Argument check and deferred execution
        • Return a new collection
          • Conversion: ToArray, ToList, ToDictionary, ToLookup
        • Return a new IEnumerable<T> sequence
          • Conversion: Cast, AsEnumerable
          • Generation: Empty , Range, Repeat, DefaultIfEmpty
          • Filtering (restriction): Where, OfType
          • Mapping (projection): Select, SelectMany
          • Grouping: GroupBy
          • Join: SelectMany, Join, GroupJoin
          • Concatenation: Concat
          • Set: Distinct, Union, Intersect, Except
          • Convolution: Zip
          • Partitioning: Take, Skip, TakeWhile, SkipWhile
          • Ordering: OrderBy, ThenBy, OrderByDescending, ThenByDescending, Reverse
        • Return a single value
          • Element: First, FirstOrDefault, Last, LastOrDefault, ElementAt, ElementAtOrDefault, Single, SingleOrDefault
          • Aggregation: Aggregate, Count, LongCount, Min, Max, Sum, Average
          • Quantifier: All, Any, Contains
          • Equality: SequenceEqual
      6. Microsoft Interactive Extensions (Ix): More powerful queries

        • Returns a new IEnumerable<T> sequence
          • Generation: Defer, Create, Return, Repeat
          • Filtering: IgnoreElements, DistinctUntilChanged
          • Mapping: SelectMany, Scan, Expand
          • Concatenation: Concat, StartWith
          • Set: Distinct
          • Partitioning: TakeLast, SkipLast
          • Conversion: Hide
          • Buffering: Buffer, Share, Publish, Memoize
          • Exception: Throw, Catch, Finally, OnErrorResumeNext, Retry
          • Imperative: If, Case, Using, While, DoWhile, Generate, For
          • Iteration: Do
        • Returns void
          • Iteration: ForEach
        • Returns a single value
          • Aggregation: Min, Max, MinBy, MaxBy
          • Quantifiers: isEmpty
      7. Building custom queries

        • Returns a new IEnumerable<T> sequence (deferred execution)
          • Generation: Create, RandomInt32, RandomDouble, FromValue, FromValues, EmptyIfNull
          • Filtering: Timeout
          • Concatenation: Join, Append, Prepend, AppendTo, PrependTo
          • Partitioning: Subsequence
          • Exception: Catch, Retry
          • Comparison: OrderBy, OrderByDescending, ThenBy, ThenByDescending, GroupBy, Join, GroupJoin, Distinct, Union, Intersect, Except
          • List: Insert, Remove, RemoveAll, RemoveAt
        • Returns a new collection
          • Comparison: ToDictionary, ToLookup
        • Returns a single value
          • List: IndexOf, LastIndexOf
          • Aggregation: PercentileExclusive, PercentileInclusive, Percentile
          • Quantifiers: IsNullOrEmpty, IsNotNullOrEmpty
          • Comparison: Contains, SequenceEqual
        • Returns void
          • Iteration: ForEach
    4. LINQ to XML: Querying XML

      1. Modeling XML

        • Imperative vs. declarative paradigm
        • Types, conversions and operators
        • Read and deserialize XML
        • Serialize and write XML
        • Deferred construction
      2. LINQ to XML standard queries

        • Navigation
        • Ordering
        • Comparison
        • More useful queries
        • XPath
        • Generate XPath expression
      3. Manipulating XML

        • Clone
        • Add, replace, delete, update, and events
        • Annotation
        • Validate with XSD
        • Transform
    5. Parallel LINQ: Querying objects in parallel

      1. Parallel LINQ query and visualization

        • Parallel LINQ classes and methods
        • Parallel query vs. sequential query
        • Execute parallel query
        • Visualize parallel query execution
          • Install and configure Concurrency Visualizer
          • Visualize sequential and parallel LINQ queries
          • Visualize chaining query methods
      2. Parallel LINQ internals: data partitioning

        • Partitioning algorithms and load balancing
          • Range partitioning
          • Stripped partitioning
          • Hash partitioning
          • Chunk partitioning
        • Implement custom partitioner
          • Static partitioner
          • Dynamic partitioner
      3. Parallel LINQ standard queries

        • Query settings
          • Cancellation
          • Degree of parallelism
          • Execution mode
          • Merge the values
        • Ordering
          • Control the order
          • Order and correctness
          • Orderable partitioner
        • Aggregation
          • Commutativity, associativity and correctness
          • Partition and merge
      4. Parallel query performance

        • Sequential vs. parallel
        • CPU bound vs. IO bound
        • Summary
    6. Entity Framework/Core and LINQ to Entities: Querying relational data

      1. Remote LINQ query

        • Entity Framework and Entity Framework Core
        • SQL database
        • Remote query vs. local query
        • Function vs. expression tree
      2. Modeling database: Object-Relational Mapping

        • Data types
        • Database
          • Connection resiliency and execution strategy
        • Tables
        • Relationships
          • One-to-one
          • One-to-many
          • Many-to-many
        • Inheritance
        • Views
        • Stored procedures and functions
      3. Logging and tracing LINQ to Entities queries

        • Application side logging
        • Database side tracing with Extended Events
      4. LINQ to Entities standard queries

        • Return a new IQueryable<T> source
          • Generation: DefaultIfEmpty
          • Filtering (restriction): Where, OfType
          • Mapping (projection): Select
          • Grouping: GroupBy
          • Join
            • Inner join: Join, SelectMany, GroupJoin, Select
            • Outer join: GroupJoin, Select, SelectMany
            • Cross join and self join: SelectMany, Join
          • Concatenation: Concat
          • Set: Distinct, Union, Intersect, Except
          • Partitioning: Take, Skip
          • Ordering: OrderBy, ThenBy, OrderByDescending, ThenByDescending
          • Conversion: Cast, AsQueryable
        • Return a single value
          • Element: First, FirstOrDefault, Single, SingleOrDefault
          • Aggregation: Count, LongCount, Min, Max, Sum, Average
          • Quantifier: All, Any, Contains
      5. LINQ to Entities internals: Query translation implementation

        • Code to LINQ expression tree
          • IQueryable<T> and IQueryProvider
          • Queryable methods
          • Build LINQ to Entities abstract syntax tree
        • .NET expression tree to database expression tree
          • Database query abstract syntax tree
          • Compile LINQ expressions to database expressions
          • Compile LINQ query method calls
          • Compile .NET API calls
          • Remote API call vs. local API call
          • Compile database function call
        • Database expression tree to SQL
          • SQL generator and SQL command
          • Generate SQL from database expression tree
      6. Loading query data

        • Deferred execution
          • Iterator pattern
          • Lazy evaluation vs. eager evaluation
        • Explicit loading
        • Eager loading
        • Lazy loading
          • The N + 1 problem
          • Disable lazy loading
      7. Manipulating relational data: Data change and transaction

        • Repository pattern and unit of work pattern
        • Track entities and changes
          • Track entities
          • Track entity changes and property changes
          • Track relationship changes
          • Enable and disable tracking
        • Change data
          • Create
          • Update
          • Delete
        • Transaction
          • Transaction with connection resiliency and execution strategy
          • EF/Core transaction
          • ADO.NET transaction
          • Transaction scope
      8. Resolving optimistic concurrency

        • Detect concurrent conflicts
        • Resolve concurrent conflicts
          • Retain database values (database wins)
          • Overwrite database values (client wins)
          • Merge with database values
        • Save changes with concurrent conflict handling
      9. Performance

        • Initialization
          • Provider initialization
          • Database initialization
          • Mapping views initialization
        • Cache
          • Entity cache
          • LINQ query translation cache
          • SQL query plan cache
        • Asynchrony
          • Asynchronous data queries and data changes
          • Transactions and connection resiliency with asynchronous operations
          • Asynchronous concurrent conflicts
    7. Lambda Calculus via C#: The foundation of all functional programming

      1. Fundamentals - Closure, Currying and Partial Application

        • About lambda calculus (λ-calculus)
        • Closure
        • Currying and partial application
        • Uncurry
        • => associativity
      2. Fundamentals - Lambda Expression, Variables, Reductions

        • Lambda expression
        • Bound and free variables
        • Reductions
          • α-conversion / alpha-conversion
          • β-reduction / beta-reduction
          • η-conversion / eta-conversion
      3. Fundamentals - Function composition

        • Function composition
          • Built-in operator in other languages
        • Properties
          • Associativity
          • Unit
      4. Encoding Church Booleans

        • Church encoding
        • Church Booleans - True and False
        • Unit test
      5. Boolean Logic

        • And
        • Or
        • Not
        • Xor
        • Conversion between Church Boolean and System.Boolean
        • Unit Tests
      6. If Logic, And Reduction Strategies

        • The first If
        • Reduction strategies
          • Normal order
          • Applicative order
        • Make If lazy
        • Unit tests
      7. Encoding Church Numerals

        • Church numerals
        • C# Implementation - starting from 0
      8. Church Numeral Arithmetic

        • Increase
        • Add
        • Decrease and subtract
      9. Wrapping Church Numerals And Arithmetic

        • Non-generic wrapper for Numeral<T>, and Increase
        • Add
        • Decrease and Subtract
        • Multiply and Pow
        • Divide?
      10. Church Numeral Arithmetic Operators

        • Operators
        • Conversion between Church numeral (now _Numeral) and System.UInt32
        • Compare _Numeral and System.UInt32
      11. Predicates, And Divide

        • Predicates
        • Divide
      12. Church Numeral Comparison Operators

        • Church Numeral Comparison Operators
          • C# object equality
        • Unit tests
      13. Encoding Church Pairs (2-Tuples) and Generic Church Booleans

        • Church pair (2-tuple)
        • Generic Church Booleans
          • Back to Church Boolean - why not using generic Church Booleans from the beginning?
        • Currying and type inference
      14. Church Pair (2-Tuple) and Church Numeral Decrease

        • Shift a Church Pair (2-Tuple)
        • Decrease a Church numeral
        • Unit tests
      15. Encoding Church List with Church Pair, And Null

        • Church pair as a Church list node
        • Encoding Null, and IsNull predicate
        • Church Boolean as Null
        • The improved Next
        • Index
        • Unit tests
      16. Encoding Church List with 2 Church Pairs as a Node

        • IsNull and Null
        • Create, Value, and Next
        • Index
        • Unit tests
      17. Encoding Church List with Fold (Aggregate) Function

        • ListNode and wrapper
        • IsNull
        • Create, value and Next
        • Index
        • Unit tests
      18. Encoding Signed Number

        • Create Signed number from Church numeral
        • Format with 0
        • Arithmetic
        • Unit tests
      19. Church Encoding, And More

        • Summary of church encoding
          • Boolean
          • Numeral
          • Predicate
          • Pair (2-tuple)
          • List
          • Signed number
        • Encode, encode, and encode<
          • From signed number to complex integer and rational number
          • From rational number to real number and complex number
          • And much more
          /li>
      20. Combinators

        • I Combinator
        • BCKW combinators
        • ω combinator
        • SKI combinators
          • Boolean in SKI, and type issue
      21. SKI Combinator Calculus

        • I Combinator
        • BCKW combinators
        • ω combinator
        • Function composition
        • Booleans
        • Numerals
        • Unit tests
      22. Iota Combinator and Jot Combinators

        • Language with 1 element
        • Completeness
        • Unit tests
      23. Y Combinator, And Divide

        • Fix point
        • Fixed point combinator
        • Recursion
          • Example – Fibonacci
        • DivideBy
        • Unit tests
    8. Category Theory via C#: The essentials and design of LINQ

      1. Fundamentals - Category, Object And Morphism

        • Category and category laws
        • The .NET category and morphism
      2. Monoid

        • Monoid and monoid laws
        • C#/.NET monoids
          • Void and Unit monoids
          • More examples
        • Nullable<T> monoid
        • Unit tests
      3. Monoid as Category

        • One monoid, one category
        • Category laws, and unit tests
      4. Functor And IEnumerable<>

        • Functor and functor laws
        • C#/.NET functors
          • Endofunctor
          • Kind issue of C# language/CLR
          • The built-in IEnumerable<> functor
        • Functor pattern of LINQ
        • IEnumerable<>, functor laws, and unit tests
      5. More Functors: Lazy<>, Func<> And Nullable<>

        • Lazy<> functor
        • Func<> functor
          • Fun< , > functor
        • Nullable<> functor
        • Functor laws, laziness, and unit tests
      6. Functor-like Tuple<>, Task<> And IQueryable<>

        • Tuple<> is like a functor
          • Tuple< , > is also like a functor
        • Laziness vs. eagerness
        • Task<T> is like a functor too
        • Purity vs. impurity
          • Purity and category theory
          • Purity and .NET
        • Purity, laziness and LINQ
          • Functor vs. functor-like
        • IQueryable<> is also like a functor
        • Hot task vs. cold task, and unit tests
      7. Natural Transformation

        • Natural transformation
        • Natural transformations for LINQ
        • More LINQ to Monads
      8. Functor Category

        • Functor Category
        • Endofunctor category
        • Monoid laws for endofunctor category, and unit tests
      9. Bifunctor

        • Bifunctor
        • C#/.NET bifunctor
        • Unit tests
      10. Monoidal Category

        • Monoidal category
        • DotNet category is monoidal category
      11. Monoidal Functor And IEnumerable<>

        • Monoidal functor
        • C#/.NET lax monoidal endofunctors
        • IEnumerable<> monoidal functor
          • N-arity selector for functor
          • Binary vs. Apply
        • Monoidal functor and LINQ
        • Applicative functor
        • Applicative laws, and unit tests
      12. More Monoidal Functors: Lazy<>, Func<> And Nullable<>

        • Lazy<> monoidal functor
        • Func<> monoidal functor
        • Nullable<> monoidal functor
        • Unit tests
      13. Monoidal Functor-like Tuple<> And Task<>

        • Tuple<>: lack of laziness
        • Task<>: lack of purity
        • Unit tests
      14. Monad And IEnumerable<>

        • Monad and monad laws
        • C#/.NET monads
        • IEnumerable<> monad and SelectMany
          • IEnumerable<> monad (SelectMany) is monoid
          • IEnumerable<> monad (SelectMany) is monoidal functor
          • IEnumerable<> monad (SelectMany) is functor
        • Monad pattern of LINQ
        • Monad laws, and unit test
      15. IEnumerable<> Monad And LINQ: SelectMany For All

        • Query methods implemented by SelectMany
        • Query methods in LINQ syntax
        • Unit tests
      16. More Monads: Lazy<>, Func<>, Nullable<>, ParallelQuery<> And IObservale<>

        • Lazy<> monad
        • Func<> monad
        • Nullable<> monad
        • ParallelQuery<> monad
        • IObservable<>  monad
        • Unit tests
      17. Monad-like Tuple<>, Task<>, IQueryable<> And IQbservable<>

        • Tuple<>: lack of laziness
        • Task<>: lack of purity
          • Task<> and LINQ
          • Non-generic Task
        • IQueryable<> is like a monad
        • IQbservable<> is also like a monad
        • Unit tests
      18. More Monad: IO<> Monad

        • IO<T> and impurity
        • IO<> monad
        • Monad laws, and unit tests
      19. More Monad: State< , > Monad

        • C#/.NET state machines
        • State pattern in object-oriented programming
        • State<> monad
        • Monad laws, and unit tests
      20. More Monad: Reader< , > Monad

        • Reader< , > Monad
        • Monad laws, and unit tests
      21. More Monad: Writer< , > Monad

        • Writer< , > monad
        • Monad laws, and unit tests
      22. More Monad: Continuation Monad

        • Continuation and continuation-passing style
        • Continuation monad
        • Monad laws, and unit tests
      23. Performance

        • Functional and purely functional
        • Cost of functional and monad
        • Cost of lambda
        • Conclusion

    74 Comments

    • thanks

    • I'm new to LINQ. I understand it's purpose. But I can't quite figure it out. I have an XML set that looks like the following:

      <Results>
      <Result>
      <ID>1</ID>
      <Name>John Smith</Name>
      <EmailAddress>john@example.com</EmailAddress>
      </Result>
      <Result>
      <ID>2</ID>
      <Name>Bill Young</Name>
      <EmailAddress>bill@example.com</EmailAddress>
      </Result>
      </Results>
      I have loaded this XML into an XDocument as such:

      string xmlText = GetXML();
      XDocument xml = XDocument.Parse(xmlText);
      Now, I'm trying to get the results into POCO format. In an effort to do this, I'm currently using:

      var objects = from results in xml.Descendants("Results")
      select new Results
      // I'm stuck
      How do I get a collection of Result elements via LINQ? I'm particularly confused about navigating the XML structure at this point in my code.

      Thank you!

    • great job tnx

    • good job

    • خرید دستگاه لیزر دایود با کیفیت از شرکت آرنا گستر امکان پذیر است.

    • Thanks in favor of sharing such a fastidious thought

    • Very descriptive article, I liked that a lot.

    • لیفت صورت

    • https://ma-study.blogspot.com/

    • تولیدكننده تسمه بسته‌بندی ، انواع دستگاه تسمه کش و عرضه کننده ملزومات بسته بندی قیمت تسمه بسته بندی
      <a href="https://denapack.ir/">قیمت تسمه بسته بندی</a>

    • I've seen your blog before, but I've never left a comment. Now I say to myself, "I have to leave a comment." So here is my comment! Keep up the great work! I liked your articles and I don't want to show it.

    • I've been looking for photos and articles on this topic over the past few days due to a school assignment, Keo nha cai and I'm really happy to find a post with the material I was looking for! I bookmark and will come often! Thanks :D

    • Betsson casino en Chile

    • It's something you're learning at school. I came here to get more information about. There is a lot of information that I didn't learn at school, so I feel really good. We will share the information with our friends as soon as possible.
      https://www.behance.net/gallery/153739069/_

    • Listado de los botes más grandes de la semana entre las loterías que se juegan en España y en Europa.

    • the content and display of your site postings. I enjoy it. Are you a game lover or do you like a Dice Roller? D4 dice are famous in Gaming. If you are thinking about how to use D4 Roll Dice. Here you can get the answer.

    • مبحث اصلی سئوپارس بازاریابی اینترنتی و کسب و کارهای آنلاین می باشد. هدف ما رشد کیفی کسب و کارهای اینترنتی ایران و همچنین بهبود روند بازاریابی اینترنتی می باشد و در این راه تمام تلاش خود را خواهیم کرد.

    • مجموعه بین‌المللی سیمرغ، به عنوانِ شرکت سرمایه گذاری - مهاجرتی هلدینگ مریدیان، شرکتی کانادایی است که طبق قوانین فدرال کانادا به ثبت رسیده است. این شرکت در راستای ارائه خدماتِ مهاجرتی - سرمایه گذاری در کانادا و آمریکا فعالیت می‌کند. شرکت سیمرغ مجموعه‌ای از زبده‌ترین و قوی‌ترین وکلای آمریکایی و کانادایی را که دارایِ بالاترین توانایی و دانش فنی، برای سهل و امن کردنِ هرچه بیشتر امور مهاجرتی هستند را در اختیارِ متقاضیان قرار می دهد.

    • مجموعه ی بین المللی سیمرغ به متقاضیان واجد شرایط کمک می کند تا برای آینده ی خانواده ی خود در کانادا سرمایه گذاری کنند. خواه سرمایه گذاری در تحصیل فرزندانشان باشد، خواه این سرمایه گذاری برای دریافتِ اقامت و گذرنامه ی کانادایی برای خانواده و یا حتی سرمایه گذاری نقدی (مانند املاک و مستغلات یا راه اندازی کسب و کار.) همچنین سرمایه گذاری در امور مالی نیز از دیگر خدمات ارزشمندی است که مجموعه ی سیمرغ می تواند در خدمت شما عزیزان قرار دهد.



    • سرمایه گذاری در آمریکا ساز و کار اصلی دولت ایالات متحده برای مدیریتِ ترویج سرمایه گذاری مستقیم خارجی است. در این مورد، تلاش‌ها بر ارتباط با دولت‌ها و سرمایه‌گذاران خارجی متمرکز است. هدف واشنگتن، حمایت از تلاش های دولت های ایالتی برای ترویج سرمایه گذاری، و رسیدگی به نگرانی های فضای کسب و کار برای جذب جامعه ی سرمایه گذاری بین المللی است. آزادی سرمایه گذاری در آمریکا، سرمایه گذاری مستقیم خارجی در این کشور را تسریع می کند و به ایجاد شغل، نوآوری و رقابت در ایالات متحده کمک می کند.

    • کفش چرم مردانه اسپرت یکی ازکفش هایی است که به تازگی مورد استقبال افراد زیادی به خصوص جوانان قرار گرفته است. این کفش ها تمامی استاندارد های لازم برای کفش راحت و منعطف را دارند.


    • همانطور که گفتیم پوسته شدن چرم در محصولات نامرغوب اتفاق می‌افتد. وقتی با پوسته شدن چرم روبرو می‌شوید، این خود چرم نیست که خراب شده، بلکه پوششی است که در زمان تولید، بر روی چرم استفاده می‌کنند. وقتی از یک ماده پاک‌کننده نادرست یا روغن بی کیفیت برای تمیز کردن چرم استفاده می‌کنید، بعد از مدتی این روکش خشک می‌شود. اگر چرم برای مدت طولانی خشک بماند، روکش ترک برمی‌دارد و با کمترین کشش، پوسته می‌شود.

    • کفش چرم مردانه اسپرت یکی ازکفش هایی است که به تازگی مورد استقبال افراد زیادی به خصوص جوانان قرار گرفته است. این کفش ها تمامی استاندارد های لازم برای کفش راحت و منعطف را دارند.

    • <p>شركت اينتكس INTEXبزرگترين شركتي است كه در زمينه توليد محصولات بادي فعاليت مي كند.تنوع توليد و كيفيت بالاي محصولات اين شركت را ،به عنوان بزرگترين و بهترين توليد كننده لوازم بادي ،آبي ،تفريحي ،كمپينگ و ورزشي قرار داده است.</p>
      <p><a href="https://intex.ir/products/catid/28">خرید پمپ باد</a></p>
      <p><a href="https://intex.ir/products/catid/29">خرید قایق بادی</a></p>
      <p><a href="https://intex.ir/products/catid/47">خرید مبل بادی</a></p>

    • شرکت ماه گوهر تابان با برند دکوتاپس در زمینه‌ی تولید صفحات کابینت ضد آب با بهره گیری از تکنوژیه نانو فعالیت دارد که محصولی با کیفیت و دوست دار محیط زیست تولید میکند.

    • چرم ارسی با بیش از سی سال تجربه در طراحی و تولید کفش سبک منحصر به فرد خود را دارد که تلفیقی از طراحی سنتی و علمی می باشد . مجموعه ارسی با با هدف رضایت مندی مشتری و زنده نگه داشتن هنر کفش ایرانی که زمانی طعنه به کفش ایرانی میزد سعی دارد به کمک شما حامیان هرچه بیشتر بر کیفیت و بروز شدن مدل ها و سبک های جدید حرکت رو به جلوی خود را ادامه دهد.

    • Los botes de loterías mundiales más grandes online. Regístrate gratis para jugar a loterías del mundo.

    • ایده ی فروشگاه اینترنتی ابزار مال از سال ۱۳۸۹ به منظور ارائه خدمات به مشتریان، در بستر الکترونیک شکل گرفت و به مرور توسعه پیدا کرد. در سال ۱۳۹۴ با شروع به کار ساماندهی وب سایت های اینترنتی، نماد اعتماد الکترونیک به عنوان مرجع شناسنامه کسب و کارهای الکترونیک برای وب سایت ابزار مال اخذ گردید. فروشگاه ابزار مال یکی از اولین کسب و کارهای الکترونیک در حوزه تخصصی ابزار آلات از در ایران می باشد.

    • شركت اينتكس INTEXبزرگترين شركتي است كه در زمينه توليد محصولات بادي فعاليت مي كند.تنوع توليد و كيفيت بالاي محصولات اين شركت را ،به عنوان بزرگترين و بهترين توليد كننده لوازم بادي ،آبي ،تفريحي ،كمپينگ و ورزشي قرار داده است.

    • کاتالوگ و لیست قیمت <a href="https://www.bargcalendar.com/">سررسید ۱۴۰۲</a>، سالنامه 1402و تقویم رومیزی 1402

    • برای خرید انواع لوازم لوکس کامیون به سایت تهران یکتا مراجعه نمائید.

    • مجله آی تی و تکنولوژی آی تی پارس


    • نماد سال ١٤٠٣حیوان اژدها ( نهنگ در ویتنام ) می باشد. در فرهنگ چینی، اژدها نشان دهنده شانس، قدرت، سلامتی و همچنین عنصر مرد یانگ است. اژدها منحصربه ‌فرد است زیرا تنها موجود افسانه ‌ای از میان تمام حیوانات زودیاک چین است و نوزادان در سال اژدها بیش از هر حیوان دیگری متولد می‌شوند.

    • قیمت گذاری بسته سئو بر اساس عوامل بسیاری مانند میزان محتوای مورد نیاز، انتظارات، پیش بینی ها برای رشد کسب و کار و محدوده خدمات مورد نیاز متفاوت است.

    • برای خرید دستگیره هوشمند به فروشگاه اینترنتی خانه آرا مراجعه نمائید.

    • طراحی لوگو و هویت تجاری کسب و کارها بر پایه اصول علمی و استاندارد جهانی.
      ما با حمایت مشتریانمان و با بهره گیری از جدیدترین متدهای طراحی آرم و لوگو توانستیم تنها در طی 11 سال، خالق بدیع ترین هویت های بصری در حوزه طراحی لوگو و آرم برای بیش از 1800 کمپانی و برند متعدد باشیم.احترام به حقوق مشتریان ، در نظر گرفتن سلایق و نقطه نظرات آنان و همراهی تا رسیدن به رضایت کاملشان، سرفصل نظام اخلاقی گروه آرمکده می باشد. همچنین ارائه مشاوره های تخصصی و کاربردی در جهت رشد و ارتقاء هویت سازمانی، یکی از اهداف اصلی این مجموعه بشمار می آید.

    • می‌توانید سررسید 1403 را از طریق اینترنت از وب‌سایت‌ها و فروشگاه‌های آنلاین معتبر مانند برگ کلندر خریداری کنید.

    • دستگاه تسمه کش بادی سیف پلیمر دارای بدنه مستحکم و بادوام جهت مصارف گوناگون صنعتی می باشد و علاوه بر استحکام ، وزن پایین و آسان بودن حمل و کار با آن ، این امکان را به مشتریان محترم می دهد که بتوانند برای مدت طولانی بدون نیاز به هرگونه تعمیر و با بازدهی بالا از آن استفاده کنند .

      https://safepolymer.com/%D8%AA%D8%B3%D9%85%D9%87-%DA%A9%D8%B4-%D9%BE%D9%86%D9%88%D9%85%D8%A7%D8%AA%DB%8C%DA%A9/

    • It's too bad to check your article late. I wonder what it would be if we met a little faster. I want to exchange a little more, but please visit my site <a href="https://google.st/url?sa=t&url=https%3A%2F%2Fwww.mtclean.blog/">casino online</a> and leave a message!!

    • Your explanation is organized very easy to understand!!! I understood at once. Could you please post about <a href="https://google.so/url?sa=t&url=https%3A%2F%2Fwww.mtclean.blog/">totosite</a> ?? Please!!

    • Of course, your article is good enough, <a href="https://google.sn/url?sa=t&url=https%3A%2F%2Fwww.mtclean.blog/">baccarat online</a> but I thought it would be much better to see professional photos and videos together. There are articles and photos on these topics on my homepage, so please visit and share your opinions.

    • When I read an article on this topic, <a href="https://google.sm/url?sa=t&url=https%3A%2F%2Fwww.mtclean.blog/">casinosite</a> the first thought was profound and difficult, and I wondered if others could understand.. My site has a discussion board for articles and photos similar to this topic. Could you please visit me when you have time to discuss this topic?

    • اگر قصد دارید یک جشن تولد خاص و بیادماندنی برای خود یا عزیزانتان برگزار کنید، ممکن است به اجاره لوازم جشن تولد نیاز پیدا کنید. اجاره لوازم جشن تولد یک راهکار مناسب و اقتصادی است که به شما امکان می‌دهد با هزینه کمتر، جشنی با کیفیت و شاد بسازید. در این مقاله، به معرفی برخی از لوازم جشن تولد که می‌توانید اجاره کنید، مزایا و معایب اجاره لوازم جشن تولد و نحوه انتخاب بهترین شرکت اجاره لوازم جشن تولد می‌پردازیم.

    • I thoroughly enjoyed diving into your post! The blend of valuable information with an engaging presentation style truly stood out. It's commendable how you've managed to create content that's both informative and a pleasure to read. Can't wait for your next piece!

    • ضمانت ارائه خدمات ترجمه و اخذ تائیدات لازم در کمترین زمان ممکن در کلیه مناطق تهران در دارالترجمه رسمی دیدمانا

    • هر روزه، میلیون‌ها نفر در سراسر جهان بازار لوازم جانبی موبایل را جستجو و خریداری می‌کنند. این لوازم شامل قاب‌های محافظ، شارژرها، هدفون‌ها، کابل‌های اتصال و اشیاء دیگری هستند که تجربه استفاده از گوشی هوشمند را بهبود می‌بخشند. با پیشرفت فناوری و گسترش بازار، انواع مختلفی از این لوازم در دسترس هستند، که انتخاب مناسب و باکیفیت می‌تواند تأثیر زیادی بر کارایی و ایمنی دستگاه موبایل داشته باشد. خرید لوازم جانبی موبایل نیازمند دقت و آگاهی از مشخصه‌ها و نیازهای فردی است تا بهترین انتخاب را انجام داد.




    • به مجموعه اقداماتی که جهت آزاد کردن کالاهای وارداتی و صادراتی از گمرک توسط صاحبان کالا و یا نماینده قانونی آن‌ها انجام می‌شود، ترخیص کالا می‌گویند. برای این امر به ارائه مدارک، پرداخت عوارض و مالیات و… نیاز خواهید داشت. پس حتما می دانید که ترخیص کالا از گمرک یکی از مهم‌ترین و اصلی‌ترین مراحل صادرات و واردات کالا محسوب می‌شود.

    • I had a great time reading through your content! It really stuck out how well the important information was presented while maintaining an interesting approach. It's admirable how you've produced stuff that's entertaining to read in addition to being educational. I look forward to your upcoming work!

    • سیم و کابل زیتون یکی از بزرگترین مجموعه های فعال در زمینه فروش سیم و کابل با کیفیت و قیمت مناسب می باشد که از سال 1375 فعالیت خود را با هدف تهیه و توزیع اقلام با کیفیت و برترِ این صنعت، آغاز نمود که همین امر باعث محبوبیت این فروشگاه در بین انبوه عرضه کنندگان شده است.

    • I am hoping the same best effort from you in the future as well. In fact your creative writing skills has inspired me.

    • Took me time to read all the comments, but I really enjoyed the article. It proved to be Very helpful to me and I am sure to all the commenters here! It’s always nice when you can not only be informed, but also entertained!

    • Fabulous message, you have signified out some amazing factors, I similarly believe this s a really remarkable web site. I will certainly visit once again for even more high quality material and additionally, advise this site to all. Many thanks.

    • Thanks for the blog loaded with so many information. Stopping by your blog helped me to get what I was looking for.

    • Thank you for taking the time to publish this information very useful!

    • I have understand your stuff previous to and you’re just too magnificent content

    • This was a really great contest and hopefully I can attend the next one. It was alot of fun and I really enjoyed myself..

    • It’s nice to know that this topic is being also covered on this web site. Really appreciate you sharing this blog.

    • For all the appliances and supplies you'll need for your next home renovation projects, Lowe's is the place to go. Our organization has no trouble servicing customers in the United States, Canada, or the United Kingdom.Users can now access an online survey that serves as a feedback poll. The organization is conducting this research to gain more understanding of the topic of customer satisfaction and to gather suggestions for raising the caliber of customer care that the business offers.

    • Great site and a great topic. I’m amazed to read this. It’s excellent. Write more

    • Really interesting, You’re overly skilled blogger. Looking forward to your fantastic post.

    • Check out this week's complete Jewel Osco Weekly Ad and the Jewel Osco Ad for next week! Look through the Jewel Osco weekly ad circular from cover to cover.

      Prepare your coupons for the early peek at the Jewel Osco weekly ad, which includes some bogo deals! Make sure you are seeing all of the most recent Jewel Osco weekly discounts by coming back frequently.
      <a href="https://jeweloscoweeklyad.shop/">Jewel Weekly Ad</a>

    • Amazon Weekly Special Offer! As an Amazon Fresh customer, you may read the current weekly ad here or use the Amazon Fresh ad preview to get a sneak peek at some forthcoming offers.Ad images are solely for informational and illustrative purposes. Dates, goods, and prices can change and aren't available at every shop. For precise information about prices, items, dates, and discounts, please visit your local merchant. Trademarks and logos belong to the people that own them.

    • Looking through the Ingles weekly flier is a relatively simple process. To make it simple to determine if the product you're looking for in this week's Ingles deals is on sale or not, the sales are divided into categories.

    • Looking through the Food City weekly flyer is a relatively simple process. To make it simple to determine if the product you're looking for is on sale or not during this week's Food City sales, the sales are divided into categories. To ensure that you never overpay, make sure to check the Food City ad for the following week to see if the product you wish to buy is on sale.

    • Thanks for sharing such a detailed and elaborated information.

    • Weekly Ad Information to come next:-

    • Tanks For Sharing Sir, Good Job, I 'am From Indonesia My Web :
















    • برای ترخیص کالا حتما با مراحل ترخیص کالا از گمرک آشنا شوید. برای دریافت اطلاعات بیشتر کلیک کنید

      <a href="https://www.hamyartejarateespadana.com/%D8%AA%D8%B1%D8%AE%DB%8C%D8%B5-%DA%A9%D8%A7%D9%84%D8%A7-%D8%A7%D8%B2-%DA%AF%D9%85%D8%B1%DA%A9/">https://www.hamyartejarateespadana.com/%D8%AA%D8%B1%D8%AE%DB%8C%D8%B5-%DA%A9%D8%A7%D9%84%D8%A7-%D8%A7%D8%B2-%DA%AF%D9%85%D8%B1%DA%A9/</a>

    • تونر کپی یکی از اجزای اصلی در چاپگرها و دستگاه‌های کپی است که به عنوان منبع تأمین رنگ برای چاپ‌های دیجیتال استفاده می‌شود. این ماده به شکل پودر است و از ذرات بسیار ریز تشکیل شده که با استفاده از تکنولوژی‌های خاص، روی کاغذ منتقل و ثابت می‌شود. نقش اصلی تونر، تضمین کیفیت بالای چاپ و وضوح تصاویر و متون است. صنعت چاپ بدون این ماده نمی‌تواند نتایج حرفه‌ای و باکیفیت ارائه دهد.

    • https://weblogs.asp.net/dixin/book

    • Customers can access their existing accounts or register for new ones online using SurgeCardInfo. Celtic Bank offers the Surge Mastercard, a credit card designed for those who want to establish or repair credit but have a poor or nonexistent credit history. Continental Finance, which operates the Surge card, can be reached at surgecardinfo or Although it will be expensive, this credit card can assist you in achieving your objective of raising your credit score.

      The credit card may come with hefty annual fees based on credit qualification. Beginning with your second year as a cardholder, the card has monthly maintenance costs in addition to these potentially significant annual expenses. Fees for international transactions, cash advance purchases, and additional authorized users.

    • Businesses in this era of internet expansion must be well-represented online. As part of this, they must ensure that their website is usable and accessible to everyone. Probably because you want to take use of Conns.com's services, you want to start utilizing your account. The following instructions will walk you through the process of activating your Conns.com account.


      Activation is the topic of our next discussion. You can see how crucial it is by realizing that activation is not just a necessary step but also the gateway to all of Conns.com's many benefits.

    • Are you unable to break out of an economic cycle? Payday loans are sometimes a wise choice. Why can't you take advantage of this chance, as 12 million Americans are? Fear is on the horizon. Do you not want to go through a grueling and pitiful loan application process?

      Payday loans give you the money you need to live your dreams for the future and to survive today. Depending on a customer's level of loyalty, it provides loans up to $3,000. You don't need to wait a long time or have flawless credit. Services are provided as quickly as you desire to realize your goals. Simply follow these steps to apply for credit and take advantage of this company's amazing features.

    • With its headquarters located in Las Vegas, Nevada, in the United States, Credit One Bank is a bank and financial services organisation that was established in 1984 and specialises in credit cards.

      Getting a Credit One credit card is really simple; all you need to do is go to their website and get pre-approved.You can find all the information you need about the Credit One Credit Card in this post.

    Add a Comment

    As it will appear on the website

    Not displayed

    Your website