Quantcast
Channel:
Browsing all 26 articles
Browse latest View live

Understanding C# Features (8) Covariance and Contravariance

[LINQ via C#] - [C# Features] In covariance/contravariance, variance is the capability to replace a type with a less-derived type or a more-derived type in a context. C# 4.0 and CLR 4 introduced...

View Article



Understanding C# Features (6) Closure

[LINQ via C#] - [C# Features] Non-local variable In a C# class, it is perfectly nature normal thing for a method to access a variable defined inside or outside its body, e.g.:public class DisplayClass{...

View Article

Understanding C# Features (7) Higher-Order Function

[LINQ via C#] - [C# Features] Function as input/output Higher-order function is a function taking one or more function parameters as input, or returning a function as output. The other functions are...

View Article

Understanding C# Features (6) Closure

[LINQ via C#] - [C# Features]Non-local variableIn a C# class, it is perfectly nature normal thing for a method to access a variable defined inside or outside its body, e.g.:public class DisplayClass{...

View Article

Understanding C# Features (7) Higher-Order Function

[LINQ via C#] - [C# Features]Function as input/outputHigher-order function is a function taking one or more function parameters as input, or returning a function as output. The other functions are...

View Article


Understanding C# Features (8) Covariance and Contravariance

[LINQ via C#] - [C# Features]In covariance/contravariance, variance is the capability to replace a type with a less-derived type or a more-derived type in a context. C# 4.0 and CLR 4 introduced...

View Article

Functional C# (1) Fundamentals

[LINQ via C#] - [Functional C#]This part introduces the basic C# syntax used in this tutorial for beginners.Types and membersC# is a strongly typed language. In C#, any value has a type. C# and .NET...

View Article

Functional C# (2) Function Type and Delegate

[LINQ via C#] - [Functional C#]In C#, functions are represented by methods. C# methods/functions have types like just C# objects have types. C# object type is represented by class, and C#...

View Article


Functional C# (3) Named Function and Static, Instance, Extension Method

[LINQ via C#] - [Functional C#]In C#, functions can be represented by methods. Classes and structures can have methods. Interfaces can only have abstract methods, which are method signatures without...

View Article


Functional C# (4) Anonymous Function, Lambda Expression and Closure

[LINQ via C#] - [Functional C#]Besides named function represented by method members, C# also supports anonymous functions without name, represented by anonymous method or lambda expression. In C#...

View Article

Functional C# (5) Function as Data and Expression Tree

[LINQ via C#] - [Functional C#]C# lambda expression is a powerful syntactic sugar. Besides representing anonymous function, the identical syntax can also represent expression tree. Lambda expression as...

View Article

Functional C# (6) Higher-order Function and First Class Function

[LINQ via C#] - [Functional C#]First order and higher-order functionHigher-order function is a function accepting one or more function parameters as input, or returning a function as output. The other...

View Article

Functional C# (7) Function Composition and Method Chaining

[LINQ via C#] - [Functional C#]Objects can be composited to build more complex object, for example, node objects can be composited to expression tree to represent function logic. Similarly, functions...

View Article


Functional C# (8) Query Expression

[LINQ via C#] - [Functional C#]C# 3.0 introduced query expression, a SQL-like query syntactic sugar, to implement query composition. As already demonstrated.Syntax and compilationThis is the full...

View Article

Functional C# (9) Covariance and Contravariance

[LINQ via C#] - [Functional C#]In covariance/contravariance, variance is the capability to replace a type with a more-derived/less-derived type in a context. C# 2.0 introduced variances for functions,...

View Article


Functional C# (10) Immutability, Anonymous Type, and Tuple

[LINQ via C#] - [Functional C#]Immutability is an important aspect of functional paradigm. As fore mentioned, imperative/object oriented programming is usually stateful, and functional programming...

View Article

Functional C# (11) Pure Function

[LINQ via C#] - [Functional C#]As fore mentioned, functional programming encourages modeling operations with pure functions.Referential transparency and side effect freeA function is pure if:It gives...

View Article


Functional C# (3) Function Parameter and Return Value

[LINQ via C#] - [Functional C#]Pass by value vs. pass by referenceIn C#, by default, arguments are passed to parameters by value. In the following example, the PassByValue function has a Uri parameter...

View Article

Functional C# (5) Local Function and Closure

[LINQ via C#] - [Functional C#]Local functionC# 7.0 introduces local function, which allows defining and calling a named, inline function inside a function member’s body. Unlike a local variable which...

View Article

Functional C# (15) Pattern matching

[LINQ via C#] - [Functional C#]Pattern matching is a common feature in functional languages. C# 7.0 introduces basic pattern matching, including constant value as pattern and type as pattern.Is...

View Article
Browsing all 26 articles
Browse latest View live




Latest Images