Tutorial by Topics: s

public void SomeMethod <T> () { } public void SomeMethod<T, V>() { } public T SomeMethod<T>(IEnumerable<T> sequence) { ... } public void SomeMethod<T>() where T : new() { } public void SomeMethod<T, V>() where T : new() where V : struct { } public void Som...
There are several kinds of collection: Array List Queue SortedList Stack Dictionary
Do not use the XmlSerializer to parse HTML. For this, special libraries are available like the HTML Agility Pack
The currently relevant HTTP/1.1 RFCs are: 7230: Message Syntax and Routing 7231: Semantics and Content 7232: Conditional Requests 7233: Range Requests 7234: Caching 7235: Authenticaion 7239: Forwarded HTTP Extension 7240: Prefer Header for HTTP There's also the following informational...
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)
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...
Provides a convenient syntax that ensures the correct use of IDisposable objects. using (disposable) { } using (IDisposable disposable = new MyDisposable()) { } The object in the using statement must implement the IDisposable interface. using(var obj = new MyObject()) { } class M...
\' — single quote (0x0027) \" — double quote (0x0022) \\ — backslash (0x005C) \0 — null (0x0000) \a — alert (0x0007) \b — backspace (0x0008) \f — form feed (0x000C) \n — new line (0x000A) \r — carriage return (0x000D) \t — horizontal tab (0x0009) \v — vertical tab (0x000B) \u0000 ...
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...
NuGet.org: NuGet is the package manager for the Microsoft development platform including .NET. The NuGet client tools provide the ability to produce and consume packages. The NuGet Gallery is the central package repository used by all package authors and consumers. Images in examples courtes...
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 ...
In C#, a method declared async won't block within a synchronous process, in case of you're using I/O based operations (e.g. web access, working with files, ...). The result of such async marked methods may be awaited via the use of the awaitkeyword. An async method can return void, Task or Tas...
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...
The using keyword is both a directive (this topic) and a statement. For the using statement (i.e. to encapsulate the scope of an IDisposable object, ensuring that outside of that scope the object becomes cleanly disposed) please see Using Statement.
Purpose And Use Cases The purpose of the Task Parallel Library is to simplify the process of writing and maintaining multithreaded and parallel code. Some Use Cases*: Keeping a UI responsive by running background work on separate task Distributing workload Allowing a client application ...
Typically a struct is used only when performance is very important. Since value types live on the stack, they can be accessed much quicker than classes. However, the stack has much less room than the heap, so structs should be kept small (Microsoft recommends structs take up no more than 16 bytes)...

Page 2 of 333