Tutorial by Topics: o

StackExchange.Redis's profiling features are composed of the IProfiler interface, and the ConnectionMultiplexer.RegisterProfiler(IProfiler), ConnectionMultiplexer.BeginProfiling(object), ConnectionMultiplexer.FinishProfiling(object) methods. Begin and Finish profiling take a context object so tha...
The .NET Framework is a set of libraries and a runtime, originally designed by Microsoft. All .NET programs compile to a bytecode called Microsoft Intermediate Language (MSIL). The MSIL is run by the Common Language Runtime (CLR). Below you can find several examples of "Hello World" in ...
In C#, an operator is a program element that is applied to one or more operands in an expression or statement. Operators that take one operand, such as the increment operator (++) or new, are referred to as unary operators. Operators that take two operands, such as arithmetic operators (+,-,*,/), ar...
public static ReturnType MyExtensionMethod(this TargetType target) public static ReturnType MyExtensionMethod(this TargetType target, TArg1 arg1, ...) ParameterDetailsthisThe first parameter of an extension method should always be preceded by the this keyword, followed by the identifier wi...
The only requirement for an object to be initialized using this syntactic sugar is that the type implements System.Collections.IEnumerable and the Add method. Although we call it a collection initializer, the object does not have to be an collection.
$"content {expression} content" $"content {expression:format} content" $"content {expression} {{content in braces}} content}" $"content {expression:format} {{content in braces}} content}" String interpolation is a shorthand for the string.Format() ...
Constructors are methods in a class that are invoked when an instance of that class is created. Their main responsibility is to leave the new object in a useful and consistent state. Destructors/Finalizers are methods in a class that are invoked when an instance of that is destroyed. In C# they are...
Keywords are predefined, reserved identifiers with special meaning to the compiler. They cannot be used as identifiers in your program without the @ prefix. For example @if is a legal identifier but not the keyword if. C# has a predefined collection of "keywords" (or reserved words) ...
Reflection is a C# language mechanism for accessing dynamic object properties on runtime. Typically, reflection is used to fetch the information about dynamic object type and object attribute values. In REST application, for example, reflection could be used to iterate through serialized response ob...
There are several kinds of collection: Array List Queue SortedList Stack Dictionary
Related: MSDN: Exceptions and Exception Handling (C# Programming Guide) MSDN: Handling and Throwing Exceptions MSDN: CA1031: Do not catch general exception types MSDN: try-catch (C# Reference)
See also: HTTP Clients
var result = possibleNullObject ?? defaultValue; ParameterDetailspossibleNullObjectThe value to test for null value. If non null, this value is returned. Must be a nullable type.defaultValueThe value returned if possibleNullObject is null. Must be the same type as possibleNullObject. The n...
X?.Y; //null if X is null else X.Y X?.Y?.Z; //null if X is null or Y is null else X.Y.Z X?[index]; //null if X is null else X[index] X?.ValueMethod(); //null if X is null else the result of X.ValueMethod(); X?.VoidMethod(); //do nothing if X is null else call X.VoidMethod(); Note that w...
A lambda expression is a syntax for creating anonymous functions inline. More formally, from the C# Programming Guide: A lambda expression is an anonymous function that you can use to create delegates or expression tree types. By using lambda expressions, you can write local functions that can ...
Properties combine the class data storage of fields with the accessibility of methods. Sometimes it may be hard to decide whether to use a property, a property referencing a field, or a method referencing a field. As a rule of thumb: Properties should be used without an internal field if th...

Page 1 of 283