Contents tagged with C# 6.0
-
C# Functional Programming In-Depth (8) Higher-order Function, Currying and First Class Function
The delegate chapter and other previous chapters have demonstrated that in C#, function supports many operations that are available for object. This chapter discusses one more aspect, higher-order function, and how it and other functional features make function the first-class citizen in C# language.
-
C# Functional Programming In-Depth (7) Expression Tree: Function as Data
C# lambda expression is a powerful syntactic sugar. Besides representing anonymous function, the same syntax can also represent expression tree. An expression tree is an immutable tree data structure that represents structure of code. For example:
-
C# Functional Programming In-Depth (6) Anonymous Function and Lambda Expression
Besides named function, C# also supports anonymous function, represented by anonymous method or lambda expression with no function name at design time. Lambda expression can also represent expression tree, This chapter discusses lambda expression as a functional feature of C# language. Lambda expression is also the core concept of lambda calculus, where functional programming originates. It is revisited in the Lambda Calculus chapters.
-
C# functional programming in-depth (3) Local Function and Closure
The previous chapter discussed named function. There is one more special kind of named function. local function. Local function can be nested in another function, and it supports an important feature closure, the ability access variable outside the local function itself.
-
C# functional programming in-depth (2) Named function and function polymorphism
This chapter starts the deep dive in functional programming with C#. C# has named function and anonymous function. In C#, the most intuitive functions are method members of class and structure, including static method, instance method, and extension method, etc. These method members are defined with names at design time and can be called by name, so they are named functions. Some other method-like members, including static constructor, constructor, finalizer, conversion operator, operator overload, property, indexer, event accessor, are also named functions, with function name generated at compiled time. This chapter discusses named functions in C#, how these named functions are defined compiled, and called, as well as their polymorphisms. A special named function, local function, is discussed in next chapter.
-
C# functional programming in-depth (1) C# language basics
The previous chapter demonstrates that C# is a standardized, cross-platform, and multi-paradigm language, and gives an overview that C# is very functional with rich features, including LINQ, a unified functional programming model to work with different data domains. Since this chapter, we dive into C# coding.
-
C# 6.0 Exception Filter and when Keyword
C# 6.0 introduces a new feature exception filter and a new keyword when. Many C# features/keywords are syntactic sugars, but exception filter/when keyword is not.
-
Convert HTML to Well-Formatted Microsoft Word Document
Recently I wanted to convert my LINQ via C# tutorial into a Word document (.doc). The tasks are:
-
C# 6.0 String Interpolation, FormattableString, and Code Analysis CA1305: Specify IFormatProvider
C# 6.0 introduces a syntactic sugar string interpolation, it is safer and more readable than composite formatting. Here is a small example: