UltimateCheat sheet


Authors

License

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

The .NET Logo is copyright of the .NET authors. - https://github.com/dotnet/brand

image/svg+xml

The project is open-source and available on GitHub. You can contribute to it by visiting project's GitHub repository: https://github.com/webmaster442/ultimatedotnetcheatsheet

Changelog

Dotnet basic commands

New

Solution management

Note: solution file name can be ignored if folder only contains one .sln file.

Package management

Build & Run

Tool management

Globally means that the tool is installed to the users profile, instead of the current project/solution.

NuGet

Formating

Workloads

Tools

Global tools are installed in $HOME/.dotnet/tools on Linux and macOS. On Windows they are installed in the %USERPROFILE%\.dotnet\tools folder. Instead of the --global switch use the --tool-path [folder] to install the tool to a custom directory. If no --global or --tool-path is specified, then the tool is installed to the current C# project.

Useful tools

Project file XML settings

Basic type system

Numerical types

Type bytes Bits Minimum value Maximum Value
byte 1 8 0 255
sbyte 1 8 -127 127
short 2 16 -32 768 32 767
ushort 2 16 0 65 535
int 4 32 -2 147 483 648 2 147 483 647
uint 4 32 0 4 294 967 295
long 8 64 -9 223 372 036 854 775 808 9 223 372 036 854 775 807
ulong 8 64 0 18 446 744 073 709 551 615
Int128 16 128 -170 141 183 460 469 231 731 687 303 715 884 105 728 170 141 183 460 469 231 731 687 303 715 884 105 727
UInt128 16 128 0 340 282 366 920 938 463 463 374 607 431 768 211 455
nint 4 or 8 32 or 64 platform dependent signed integer platform dependent signed integer
nuint 4 or 8 32 or 64 platform dependent unsigned integer platform dependent unsigned integer
float 4 32 -3.4028235 x 1038 3.4028235 x 1038
double 8 64 -1.7976931348623157 x 10308 1.7976931348623157 x 10308
decimal 16 128 -7.92 x 10 28 7.92 x 10 28
Half 2 16 -65 504 65 504

Note: nint and nuint represent the platforms native integer type. For 32 bit systems this will be a 32 bit integer, so the limitations and properties of int or uint aplies. On 64 bit systems the limitations and properties of long and ulong applies.

Smallest representable number in floating types, that is not zero:

Numerical types provided by .NET

Generic Math Interfaces

[INumberBase\<T\>| Defines the base of other number types.] [INumber\<T\>|Defines a number type.] [ISignedNumber\<T\>|Defines a number type which can represent both positive and negative values.] [IUnsignedNumber<Tself>|Defines a number type that can only represent positive values.] [IBinaryNumber\<T\>|Defines a number that is represented in a base-2 format.] [IBinaryInteger\<T\>|Defines an integer type that is represented in a base-2 format.] [IFloatingPoint\<T\>|Defines a floating-point type.] [IFloatingPointIeee754\<T\>|Defines an IEEE 754 floating-point type.] [IBinaryFloatingPointIeee754\<T\>|Defines an IEEE 754 floating-point type that is represented in a base-2 format.] [INumberBase\<T\>] <:- [ISignedNumber\<T\>] <:- [IFloatingPoint\<T\>] <:- [IFloatingPointIeee754\<T\>] <:- [IBinaryFloatingPointIeee754\<T\>] [INumberBase\<T\>] <:- [IUnsignedNumber<Tself>] [INumberBase\<T\>] <:- [INumber\<T\>] <:- [IBinaryNumber\<T\>] <:- [IBinaryInteger\<T\>] INumberBase<T> Defines the base of other number types. INumber<T> Defines a number type. ISignedNumber<T> Defines a number type which can represent both positive and negative values. IUnsignedNumber<Tself> Defines a number type that can only represent positive values. IBinaryNumber<T> Defines a number that is represented in a base-2 format. IBinaryInteger<T> Defines an integer type that is represented in a base-2 format. IFloatingPoint<T> Defines a floating-point type. IFloatingPointIeee754<T> Defines an IEEE 754 floating-point type. IBinaryFloatingPointIeee754<T> Defines an IEEE 754 floating-point type that is represented in a base-2 format.

Interfaces / Types SByte, Int16, Int32, Int64 Int128 Byte, UInt16, UInt32, UInt64 UInt128 Half Single, Double Decimal Complex BigInteger
INumberBase<T>
INumber<T>
ISignedNumber<T>
IUnsignedNumber<Tself>
IBinaryNumber<T>
IBinaryInteger<T>
IFloatingPoint<T>
IFloatingPointIeee754<T>
IBinaryFloatingPointIeee754<T>
IComparable<T>
IConvertible
IEquatable<T>
IParsable<T>
ISpanParsable<T>
IAdditionOperators<TSelf,TSelf,TSelf>
IBitwiseOperators<TSelf,TSelf,TSelf>
IComparisonOperators<TSelf,TSelf,bool>
IDecrementOperators<T>
IDivisionOperators<TSelf,TSelf,TSelf>
IEqualityOperators<TSelf,TSelf,bool>
IIncrementOperators<T>
IModulusOperators<TSelf,TSelf,TSelf>
IMultiplyOperators<TSelf,TSelf,TSelf>
IShiftOperators<TSelf,int,TSelf>
ISubtractionOperators<TSelf,TSelf,TSelf>
IUnaryNegationOperators<TSelf,TSelf>
IUnaryPlusOperators<TSelf,TSelf>
IAdditiveIdentity<TSelf,TSelf>
IMultiplicativeIdentity<TSelf,TSelf>
IMinMaxValue<T>
IExponentialFunctions<T>
IFloatingPointConstants<T>
IHyperbolicFunctions<T>
ILogarithmicFunctions<T>
IPowerFunctions<T>
IRootFunctions<T>
ITrigonometricFunctions<T>

Important interfaces for types

IComparable<T>

Defines a generalized comparison method that a value type or class implements to create a type-specific comparison method for ordering or sorting its instances.

interface IComparable<T>
{
	int CompareTo (T? other);
}

The CompareTo returns a value that indicates the relative order of the objects being compared. The return value has these meanings:

Value Meaning
Less than zero This instance precedes other in the sort order.
Zero This instance occurs in the same position in the sort order as other.
Greater than zero This instance follows other in the sort order.

IComparer<T>

Defines a method that a type implements to compare two objects.

This interface is used with the List<T>.Sort and List<T>.BinarySearch methods. It provides a way to customize the sort order of a collection. Classes that implement this interface include the SortedDictionary<TKey,TValue> and SortedList<TKey,TValue> generic classes.

The default implementation of this interface is the Comparer<T> class. The StringComparer class implements this interface for type String.

interface IComparer<T>
{
	int Compare (T? x, T? y);
}

Return a signed integer that indicates the relative values of x and y, as shown in the following table:

Value Meaning
Less than zero x is less than y.
Zero x equals y.
Greater than zero x is greater than y.

IEquatable<T>

Defines a generalized method that a value type or class implements to create a type-specific method for determining equality of instances.

interface IEquatable<T>
{
	bool Equals (T? other);
}

Note: If a type implements the IEquatable<T>, then the type must override the Equals(object? other) and GetHashCode() methods provided also.

EqualityComparer<T>

Defines methods to support the comparison of objects for equality. This interface allows the implementation of customized equality comparison for collections. That is, you can create your own definition of equality for type T, and specify that this definition be used with a collection type that accepts the IEqualityComparer<T> generic interface.

interface IEqualityComparer<T>
{
	bool Equals (T? x, T? y);
	int GetHashCode (T obj);
}

IDisposable & IAsyncDisposable

The IDisposable interface is used to release unmanaged resources like file handles, database connections, network connections, or any resource that is not managed by the .NET runtime.

The IDisposable interface is typically implemented when a class holds onto resources that need to be explicitly released or closed to avoid potential resource leaks and do a proper clean-up. By implementing IDisposable, you can provide a mechanism for users of your class to explicitly release those resources when they're done with them, rather than relying on the garbage collector to eventually clean them up.

The IAsyncDisposable interface is similar to IDisposable, but it is specifically designed for asynchronous resource clean-up scenarios.

If you implement the IAsyncDisposable interface but not the IDisposable interface, your app can potentially leak resources. If a class implements IAsyncDisposable, but not IDisposable, and a consumer only calls Dispose(), your implementation would never call DisposeAsync(). This would result in a resource leak.

Implementation example:

public class AsyncDisposable : IAsyncDisposable, IDisposable
{
    //a flag to indicate whether the object has been disposed to prevent multiple dispose calls
    private bool _disposed;

    //A disposable field
    private readonly MemoryStream _field;

    public AsyncDisposable()
    {
        _field = new MemoryStream();
    }

    //IDosposable implementation. Do not change this code. Put cleanup code in the Dispose(bool disposing) method
    public void Dispose()
    {
        Dispose(disposing: true);
        GC.SuppressFinalize(this);
    }

    //IAsyncDisposable implementation. Do not change this code. Put cleanup code in the DisposeAsyncCore method
    public async ValueTask DisposeAsync()
    {
        //Call the overridable DisposeAsyncCore that does the actual work
        await DisposeAsyncCore().ConfigureAwait(false);

        //no need to call finalizer, because the resources have been freed by the DisposeAsyncCore method
        GC.SuppressFinalize(this);
    }

    // Async version of Dispose method
    protected virtual async ValueTask DisposeAsyncCore()
    {
        if (!_disposed)
        {
            await _field.DisposeAsync().ConfigureAwait(false);
        }
    }

    // Sync version of Dispose method
    protected virtual void Dispose(bool disposing)
    {
        if (!_disposed)
        {
            if (disposing)
            {
                //Dispose managed state (managed objects)
                _field.Dispose();
            }

            // TODO: free unmanaged resources (unmanaged objects) and override finalizer
            // TODO: set large fields to null
            _disposed = true;
        }
    }

    //TODO: override finalizer only if 'Dispose(bool disposing)' has code to free unmanaged resources
    // ~AsyncDisposable()
    // {
    //     // Do not change this code. Put clean-up code in Dispose(bool disposing) method
    //     Dispose(disposing: false);
    // }
}

Operator Precedence

  1. Primary:

    x.y, f(x), a[i], x?.y, x?[y], x++, x--, x!, new, typeof, checked, unchecked, default, nameof, delegate, sizeof, stackalloc, x->y

  2. Unary: +x, -x, !x, ~x, ++x, --x, ^x, (T)x, await, &x, *x, true and false

  3. Range: x..y

  4. Switch and with expressions: switch, with

  5. Multiplicative: x * y, x / y, x % y

  6. Additive: x + y, x – y

  7. Shift: x << y, x >> y, x >>> y

  8. Relational and type-testing: x < y, x > y, x <= y, x >= y, is, as

  9. Equality: x == y, x != y

  10. Boolean logical AND or bitwise logical AND: x & y`

  11. Boolean logical XOR or bitwise logical XOR: x ^ y

  12. Boolean logical OR or bitwise logical OR: x | y

  13. Conditional AND: x && y

  14. Conditional OR: x || y

  15. Null-coalescing operator: x ?? y

  16. Conditional operator: c ? t : f

  17. Assignment and lambda declaration:

    x = y, x += y, x -= y, x *= y, x /= y, x %= y, x &= y, x |= y, x ^= y, x <<= y, x >>= y, x >>>= y, x ??= y, =>

More info: https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/operators/

Access modifiers

Caller's location public protected internal protected internal private protected private
Within the class
Derived class (same assembly) X
Non-derived class (same assembly) X X X
Derived class (different assembly) X X X
Non-derived class (different assembly) X X X X X

More info: https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/access-modifiers

Strings

More infos:

String escape sequences

Escape sequence Character name
\' Single quote
\ Double quote
\\ Backslash
\0 Null
\a Alert
\b Backspace
\f Form feed
\n New line
\r Carriage return
\t Horizontal tab
\v Vertical tab
\u Unicode escape sequence (UTF-16) followed by 4 hex digits
\U Unicode escape sequence (UTF-32) followed by 8 hex digits
\x Unicode escape sequence similar to "\u" except with variable length

Numeric format strings

Format specifier Name Supported Description
C or c Currency All numeric types Formats value as currency
D or d Decimal Integral types Integer digits with optional negative sign.
E or e Exponential All numeric types Exponential notation
F or f Fixed-point All numeric types Integral and decimal digits with optional negative sign.
G or g General All numeric types The more compact of either fixed-point or scientific notation.
N or n Number All numeric types Integral and decimal digits, group separators, and a decimal separator with optional negative sign.
P or p Percent All numeric types Number multiplied by 100 and displayed with a percent symbol.
R or r Round-trip Single, Double, BigInteger A string that can round-trip to an identical number.
X or x Hexadecimal Integral types A hexadecimal string.
any other Unknown All numeric types Throws a FormatException at run time.

Custom numeric format strings

Format specifier Name Description
0 Zero placeholder Replaces the zero with the corresponding digit if one is present; otherwise, zero appears in the result string.
# Digit placeholder Replaces the "#" symbol with the corresponding digit if one is present; otherwise, no digit appears in the result string.
. Decimal point Determines the location of the decimal separator in the result string.
, Group separator, number scaling I Serves as both a group separator and a number scaling specifier.
% Percentage placeholder Multiplies a number by 100 and inserts a localized percentage symbol in the result string.
Per mille placeholder Multiplies a number by 1000 and inserts a localized per mille symbol in the result string.
E0 Exponential notation II If followed by at least one 0 (zero), formats the result using exponential notation.
\ Escape character III Causes the next character to be interpreted as a literal rather than as a custom format specifier.
; Section separator IV Defines sections with separate format strings for positive, negative, and zero numbers.
any other All other characters The character is copied to the result string unchanged.

I: . As a group separator, it inserts a localized group separator character between each group. As a number scaling specifier, it divides a number by 1000 for each comma specified.

II: The case of "E" or "e" indicates the case of the exponent symbol in the result string. The number of zeros following the "E" or "e" character determines the minimum number of digits in the exponent. A plus sign (+) indicates that a sign character always precedes the exponent. A minus sign (-) indicates that a sign character precedes only negative exponents.

III: The #, 0, ., ,, %, and symbols in a format string are interpreted as format specifiers rather than as literal characters. Depending on their position in a custom format string, the uppercase and lowercase "E" as well as the + and - symbols may also be interpreted as format specifiers.

IV: The semicolon (;) is a conditional format specifier that applies different formatting to a number depending on whether its value is positive, negative, or zero. To produce this behaviour, a custom format string can contain up to three sections separated by semicolons. These sections are:

Standard date and time format strings

Format specifier Description Example (en-Us culture)
d Short date pattern 6/15/2009
D Long date pattern Monday, June 15, 2009
f Full date/time pattern (short time) Monday, June 15, 2009 1:45 PM
F Full date/time pattern (long time) Monday, June 15, 2009 1:45:30 PM
g General date/time pattern (long time) 6/15/2009 1:45:30 PM
m or M Month/day pattern June 15
O or o Round-trip date/time pattern 2009-06-15T13:45:30.0000000-07:00
R or r RFC1123 pattern Mon, 15 Jun 2009 20:45:30
s Sortable date/time pattern 2009-06-15T13:45:30
t Short time pattern 1:45 PM
T Long time pattern 1:45:30 PM
u Universal sortable date/time pattern 2009-06-15 13:45:30Z
U Universal full date/time pattern Monday, June 15, 2009 8:45:30 PM
Y or y Year month pattern June 2009

Custom date and time format strings

Format specifier Description
d The day of the month, from 1 through 31.
dd The day of the month, from 01 through 31
ddd The abbreviated name of the day of the week
dddd The full name of the day of the week
g or gg The period or era
h The hour, using a 12-hour clock from 1 to 12
hh The hour, using a 12-hour clock from 01 to 12
H The hour, using a 24-hour clock from 0 to 23
HH The hour, using a 24-hour clock from 00 to 23
K Time zone information
m The minute, from 0 through 59
mm The minute, from 00 through 59
M The month, from 1 through 12
MM The month, from 01 through 12
MMM The abbreviated name of the month
MMMM The full name of the month
s The second, from 0 through 59
ss The second, from 00 through 59
t The first character of the AM/PM designator
tt The AM/PM designator
y The year, from 0 to 99
yy The year, from 00 to 99
yyy The year, with a minimum of three digits
yyyy The year as a four-digit number
yyyyy The year as a five-digit number
z Hours offset from UTC, with no leading zeros
zz Hours offset from UTC, with a leading zero for a single-digit value
zzz Hours and minutes offset from UTC
: The time separator
/ The date separator
\ The escape character

Common exceptions

#direction: right #spacing: 8 #gravity: .8 [ArithmeticException|The exception that is thrown for errors in an arithmetic, casting, or conversion operation] [Exception|Represents errors that occur during application execution.] [RuntimeBinderException|Represents an error that occurs when a dynamic bind in the C# runtime binder is processed.] [AggregateException|Represents one or more errors that occur during application execution.] [ApplicationException|Serves as the base class for application-defined exceptions] [JsonException|Defines a custom exception object that is thrown when invalid JSON text is encountered] [SystemException|Serves as the base class for system exceptions] [AccessViolationException|An access violation occurs in unmanaged or unsafe code when the code attempts to read or write to memory that has not been allocated, or to which it does not have access. This usually occurs because a pointer has a bad value.] [DivideByZeroException|The exception that is thrown when there is an attempt to divide an integral or Decimal value by zero.] [OverflowException|The exception that is thrown when an arithmetic, casting, or conversion operation in a checked context results in an overflow.] [NotFiniteNumberException|The exception that is thrown when a floating-point value is positive infinity, negative infinity, or Not-a-Number (NaN).| Available for programming languages that do not support the concepts of infinity and Not-a-Number in floating-point operations.] [FormatException|The exception that is thrown when the format of an argument is invalid, or when a composite format string is not well formed.] [StackOverflowException|The exception that is thrown when the execution stack exceeds the stack size. This class cannot be inherited.] [InvalidCastException|The exception that is thrown for invalid casting or explicit conversion.] [InvalidOperationException|The exception that is thrown when a method call is invalid for the object's current state.] [OutOfMemoryException|The exception that is thrown when there is not enough memory to continue the execution of a program.] [IOException|he exception that is thrown when an I/O error occurs.] [IndexOutOfRangeException|The exception that is thrown when an attempt is made to access an element of an array or collection with an index that is outside its bounds.] [DirectoryNotFoundException|The exception that is thrown when part of a file or directory cannot be found.] [DriveNotFoundException|The exception that is thrown when trying to access a drive or share that is not available.] [EndOfStreamException|The exception that is thrown when reading is attempted past the end of a stream.] [FileLoadException|The exception that is thrown when a managed assembly is found but cannot be loaded.] [FileNotFoundException|The exception that is thrown when an attempt to access a file that doesnot exist on disk fails.] [NullReferenceException|The exception that is thrown when there is an attempt to dereference a null object reference.] [PathTooLongException|The exception that is thrown when a path or fully qualified file name is longer than the system-defined maximum length.] [NotImplementedException|The exception that is thrown when a requested method or operation is not implemented.] [NotSupportedException|The exception that is thrown when an invoked method is not supported, or when there is an attempt to read, seek, or write to a stream that does not support the invoked functionality.] [PlatformNotSupportedException|The exception that is thrown when a feature does not run on a particular platform.] [Exception] <- [RuntimeBinderException] [Exception] <- [SystemException] [Exception] <- [AggregateException] [Exception] <- [ApplicationException] [Exception] <- [JsonException] [SystemException] <- [ArithmeticException] [SystemException] <- [AccessViolationException] [SystemException] <- [FormatException] [SystemException] <- [InvalidOperationException] [SystemException] <- [StackOverflowException] [SystemException] <- [OutOfMemoryException] [SystemException] <- [IOException] [SystemException] <- [IndexOutOfRangeException] [SystemException] <- [NullReferenceException] [SystemException] <- [NotImplementedException] [SystemException] <- [NotSupportedException] <- [PlatformNotSupportedException] [IOException] <- [DirectoryNotFoundException] [IOException] <- [DriveNotFoundException] [IOException] <- [EndOfStreamException] [IOException] <- [FileLoadException] [IOException] <- [FileNotFoundException] [IOException] <- [PathTooLongException] [ArithmeticException] <- [DivideByZeroException] [ArithmeticException] <- [NotFiniteNumberException] [ArithmeticException] <- [InvalidCastException] [ArithmeticException] <- [OverflowException] ArithmeticException The exception that is thrown for errors in an arithmetic, casting, or conversion operation Exception Represents errors that occur during application execution. RuntimeBinderException Represents an error that occurs when a dynamic bind in the C# runtime binder is processed. AggregateException Represents one or more errors that occur during application execution. ApplicationException Serves as the base class for application-defined exceptions JsonException Defines a custom exception object that is thrown when invalid JSON text is encountered SystemException Serves as the base class for system exceptions AccessViolationException An access violation occurs in unmanaged or unsafe code when the code attempts to read or write to memory that has not been allocated, or to which it does not have access. This usually occurs because a pointer has a bad value. DivideByZeroException The exception that is thrown when there is an attempt to divide an integral or Decimal value by zero. OverflowException The exception that is thrown when an arithmetic, casting, or conversion operation in a checked context results in an overflow. NotFiniteNumberException The exception that is thrown when a floating-point value is positive infinity, negative infinity, or Not-a-Number (NaN). Available for programming languages that do not support the concepts of infinity and Not-a-Number in floating-point operations. FormatException The exception that is thrown when the format of an argument is invalid, or when a composite format string is not well formed. StackOverflowException The exception that is thrown when the execution stack exceeds the stack size. This class cannot be inherited. InvalidCastException The exception that is thrown for invalid casting or explicit conversion. InvalidOperationException The exception that is thrown when a method call is invalid for the object's current state. OutOfMemoryException The exception that is thrown when there is not enough memory to continue the execution of a program. IOException he exception that is thrown when an I/O error occurs. IndexOutOfRangeException The exception that is thrown when an attempt is made to access an element of an array or collection with an index that is outside its bounds. DirectoryNotFoundException The exception that is thrown when part of a file or directory cannot be found. DriveNotFoundException The exception that is thrown when trying to access a drive or share that is not available. EndOfStreamException The exception that is thrown when reading is attempted past the end of a stream. FileLoadException The exception that is thrown when a managed assembly is found but cannot be loaded. FileNotFoundException The exception that is thrown when an attempt to access a file that doesnot exist on disk fails. NullReferenceException The exception that is thrown when there is an attempt to dereference a null object reference. PathTooLongException The exception that is thrown when a path or fully qualified file name is longer than the system-defined maximum length. NotImplementedException The exception that is thrown when a requested method or operation is not implemented. NotSupportedException The exception that is thrown when an invoked method is not supported, or when there is an attempt to read, seek, or write to a stream that does not support the invoked functionality. PlatformNotSupportedException The exception that is thrown when a feature does not run on a particular platform.

Collections

#direction: right [IDisposable| void Dispose()] <:- [IEnumerator] [IEnumerator| object Current { get } bool MoveNext() void Reset()] [IEnumerator<out T>| IEnumerator<T> GetEnumerator()] [IEnumerator] <:- [IEnumerator<out T>] [IEnumerator] <--[IEnumerable] [IEnumerator<out T>] <-- [IEnumerable<T>] [IEnumerable| IEnumerator GetEnumerator()] <:- [IEnumerable<T>] [IEnumerable<T>| IEnumerator<T> GetEnumerator()] IDisposable void Dispose() IEnumerator object Current { get } bool MoveNext() void Reset() IEnumerator<out T> IEnumerator<T> GetEnumerator() IEnumerable IEnumerator GetEnumerator() IEnumerable<T> IEnumerator<T> GetEnumerator()

#direction: right #spacing: 15 [IEnumerable| IEnumerator GetEnumerator()] <:- [IEnumerable<T>] [IEnumerable<T>| IEnumerator<T> GetEnumerator()] [IReadOnlyCollection<T>| int Count \{ get \}] [IReadOnlyList<T>| T this\[int index\]] [IReadOnlySet<T>| bool Contains(T item); bool IsProperSubsetOf(IEnumerable<T> other) bool IsProperSupersetOf(IEnumerable<T> other) bool IsSubsetOf(IEnumerable<T> other) bool IsSupersetOf(IEnumerable<T> other) bool Overlaps(IEnumerable<T> other) bool SetEquals(IEnumerable<T> other)] [IReadOnlyDictionary<TKey, TValue>| TValue this\[TKey key\] \{ get \} IEnumerable<TKey> Keys \{ get \} IEnumerable<TValue> Values \{ get \}| bool ContainsKey(TKey key) bool TryGetValue(TKey key, out TValue value)] [ICollection<T>| int Count \{ get \} bool IsReadOnly \{ get \}| void Add(T item) void Clear() bool Contains(T item) void CopyTo(T\[\] array, int arrayIndex); bool Remove(T item)] [IList<T>| T this\[int index\] { get set }| int IndexOf(T item) void Insert(int index, T item) void RemoveAt(int index)] [ISet<T>| void ExceptWith(IEnumerable<T> other) void IntersectWith(IEnumerable<T> other) bool IsProperSubsetOf(IEnumerable<T> other) bool IsProperSupersetOf(IEnumerable<T> other) bool IsSubsetOf(IEnumerable<T> other) bool IsSupersetOf(IEnumerable<T> other) bool Overlaps(IEnumerable<T> other) bool SetEquals(IEnumerable<T> other) void SymmetricExceptWith(IEnumerable<T> other) void UnionWith(IEnumerable<T> other)] [IDictionary<TKey, TValue>| TValue this\[TKey key\] { get set } ICollection<TKey> Keys { get } ICollection<TValue> Values { get }| void Add(TKey key, TValue value) bool ContainsKey(TKey key) bool Remove(TKey key) bool TryGetValue(TKey key, out TValue value)] [IEnumerable<T>] <:- [IReadOnlyCollection<T>] [IEnumerable<T>] <:- [ICollection<T>] [ICollection<T>] <:- [IList<T>] [ICollection<T>] <:- [ISet<T>] [ICollection<T>] <:- [IDictionary<TKey, TValue>] [IReadOnlyCollection<T>] <:- [IReadOnlyList<T>] [IReadOnlyCollection<T>] <:- [IReadOnlySet<T>] [IReadOnlyCollection<T>] <:- [IReadOnlyDictionary<TKey, TValue>] IEnumerable IEnumerator GetEnumerator() IEnumerable<T> IEnumerator<T> GetEnumerator() IReadOnlyCollection<T> int Count { get } IReadOnlyList<T> T this[int index] IReadOnlySet<T> bool Contains(T item) bool IsProperSubsetOf(IEnumerable<T> other) bool IsProperSupersetOf(IEnumerable<T> other) bool IsSubsetOf(IEnumerable<T> other) bool IsSupersetOf(IEnumerable<T> other) bool Overlaps(IEnumerable<T> other) bool SetEquals(IEnumerable<T> other) IReadOnlyDictionary<TKey, TValue> TValue this[TKey key] { get } IEnumerable<TKey> Keys { get } IEnumerable<TValue> Values { get } bool ContainsKey(TKey key) bool TryGetValue(TKey key, out TValue value) ICollection<T> int Count { get } bool IsReadOnly { get } void Add(T item) void Clear() bool Contains(T item) void CopyTo(T[] array, int arrayIndex) bool Remove(T item) IList<T> T this[int index] { get set } int IndexOf(T item) void Insert(int index, T item) void RemoveAt(int index) ISet<T> void ExceptWith(IEnumerable<T> other) void IntersectWith(IEnumerable<T> other) bool IsProperSubsetOf(IEnumerable<T> other) bool IsProperSupersetOf(IEnumerable<T> other) bool IsSubsetOf(IEnumerable<T> other) bool IsSupersetOf(IEnumerable<T> other) bool Overlaps(IEnumerable<T> other) bool SetEquals(IEnumerable<T> other) void SymmetricExceptWith(IEnumerable<T> other) void UnionWith(IEnumerable<T> other) IDictionary<TKey, TValue> TValue this[TKey key] { get set } ICollection<TKey> Keys { get } ICollection<TValue> Values { get } void Add(TKey key, TValue value) bool ContainsKey(TKey key) bool Remove(TKey key) bool TryGetValue(TKey key, out TValue value)

Type Description Is
T[] Represents an Array IList<T>, IReadonlyList<T>
List<T> Represents a strongly typed list of objects that can be accessed by index IList<T>, IReadonlyList<T>
Dictionary<TKey, TValue> Represents a collection of keys and values IReadOnlyDictionary<TKey, TValue>, IDictionary<TKey, TValue>
HashSet<T> Represents a set of values ISet<T>, IReadOnlySet<T>
Queue<T> Represents a first-in, first-out collection ICollection<T>, IReadOnlyCollection<T>
PriorityQueue<TElement, TPriority> On Dequeue the item with the lowest priority value is removed --
Stack<T> Represents a variable size last-in-first-out (LIFO) collection ICollection<T>, IReadOnlyCollection<T>
LinkedList<T> Represents a doubly linked list ICollection<T>, IReadOnlyCollection<T>

Concurrent Collections

Type Description Is
BlockingCollection<T> Provides blocking and bounding capabilities for thread-safe collections IReadOnlyCollection<T>
ConcurrentBag<T> Represents a thread-safe, unordered collection of objects IReadOnlyCollection<T>, IProducerConsumerCollection<T>
ConcurrentDictionary<TKey,TValue> Represents a thread-safe collection of key/value pairs IReadOnlyDictionary<TKey,TValue>, IDictionary<TKey,TValue>
ConcurrentQueue<T> Represents a thread-safe first in-first out (FIFO) collection IReadOnlyCollection<T>, IProducerConsumerCollection<T>
ConcurrentStack<T> Represents a thread-safe last in-first out (LIFO) collection IReadOnlyCollection<T>, IProducerConsumerCollection<T>

LINQ

Filtering

var customerOrders = Orders.Where(order => order.CustomerId == 66);

Select with anonymus type

var ordersWithCost = Orders.Select(order => new
{
    OrderId = order.Id,
    Cost = order.Cost,
});

Ordering

var ascendingOrder = orders.OrderBy(order => order.Cost);
var descendingOrder = orders.OrderByDescending(order => order.Cost);

var multipleOdering = orders.OrderBy(order => order.Cost).ThenBy(order => order.CustomerId);

Join

var joined = customers.Join(orders, 
                            customer => customer.Id, 
                            order => order.CustomerId
                            (customer, order) => new
                            {
                                CustomerId = customer.Id,
                                Name = customer.Name,
                                Cost = order.Cost, 
                            });

Grouping

var grouped = orders.GroupBy(order => CustomerId);

Skip & Take

var take3 = orders.Take(3);
var next3 = orders.Skip(3).Take(3);

Element operations

//throws exception if element not found
var firstCustomer = customers.First(customer => customer.Id == 63);
var lastCustomer = customers.Last(customer => customer.Id == 63);
//returns default value if element not found
var firstCustomer = customers.FirstOrDefault(customer => customer.Id == 63);
var lastCustomer = customers.LastOrDefault(customer => customer.Id == 63);

Conversions

Order[] orders = Orders.Where(order => order.CustomerId == 66).ToArray();
List<Order> orders = Orders.Where(order => order.CustomerId == 66).ToList();
HashSet<Order> orders = Orders.Where(order => order.CustomerId == 66).ToHashSet();
Dictionary<int, string> customerDictionary
     = Customers.ToDictionary(customer => customer.Id, customer => customer.Name);

Pattern matching

Discard pattern

The discard pattern can be used to match any expression, including null. It's represented by the _ symbol.

bool isFloatingPointNumber(string input)
{
    //the out value of the conversion is discarded
    return double.TryParse(input, out double _);
}

var pattern

The var pattern can be used to match any expression, including null, and assign its result to a new local variable:

bool isFloatingPointNumber(string input)
{
    return double.TryParse(input, out var _);
}

Declaration and type patterns

object greeting = "Hello, World!";
if (greeting is string message)
{
	//greeting is a string and casted to message variable
}

A declaration pattern with type T matches an expression when an expression result is non-null and any of the following conditions are true:

Null checking:

if (input is not null)
{
    // ...
}

Type checking in switch:

public abstract class Vehicle {}
public class Car : Vehicle {}
public class Truck : Vehicle {}

public static class TollCalculator
{
    public static decimal CalculateToll(this Vehicle vehicle) => vehicle switch
    {
        Car _ => 2.00m,
        Truck _ => 7.50m,
        null => throw new ArgumentNullException(nameof(vehicle)),
        _ => throw new ArgumentException("Unknown type of a vehicle", nameof(vehicle)),
    };
}

Constant pattern

public static decimal GetGroupTicketPrice(int visitorCount) => visitorCount switch
{
    1 => 12.0m,
    2 => 20.0m,
    3 => 27.0m,
    0 => 0.0m,
    _ => throw new ArgumentException($"Not supported number of visitors: {visitorCount}", nameof(visitorCount)),
};

In a constant pattern, you can use any constant expression, such as integers, floating-point numbers, char, string, boolean, enums, name of a declared const field or local and null. Note: Span<char> or ReadOnlySpan<char> can also be matched in the constant pattern, but in C# 11 and later versions

Relational patterns

static string Classify(double measurement) => measurement switch
{
    < -4.0 => "Too low",
    > 10.0 => "Too high",
    double.NaN => "Unknown",
    _ => "Acceptable",
};

In a relational pattern, you can use any of the relational operators <, >, <=, or >=. The right-hand part of a relational pattern must be a constant expression. For the constant expression, the constant pattern limitations apply.

Logical patterns

static string Classify(double measurement) => measurement switch
{
    < -40.0 => "Too low",
    >= -40.0 and < 0 => "Low",
    >= 0 and < 10.0 => "Acceptable",
    >= 10.0 and < 20.0 => "High",
    >= 20.0 => "Too high",
    double.NaN => "Unknown",
};
static string GetCalendarSeason(DateTime date) => date.Month switch
{
    3 or 4 or 5 => "spring",
    6 or 7 or 8 => "summer",
    9 or 10 or 11 => "autumn",
    12 or 1 or 2 => "winter",
    _ => throw new ArgumentOutOfRangeException(nameof(date), $"Date with unexpected month: {date.Month}."),
};

Precedence: not, and, or. To explicitly specify the precedence, use parentheses:

static bool IsLetter(char c) => c is (>= 'a' and <= 'z') or (>= 'A' and <= 'Z');

Property Pattern

static bool IsConferenceDay(DateTime date) => date is { Year: 2020, Month: 5, Day: 19 or 20 or 21 };

A property pattern matches an expression when an expression result is non-null and every nested pattern matches the corresponding property or field of the expression result. It can be combined with run-time type check and variable declaration:

static string TakeFive(object input) => input switch
{
    string { Length: >= 5 } s => s.Substring(0, 5),
    string s => s,

    ICollection<char> { Count: >= 5 } symbols => new string(symbols.Take(5).ToArray()),
    ICollection<char> symbols => new string(symbols.ToArray()),

    null => throw new ArgumentNullException(nameof(input)),
    _ => throw new ArgumentException("Not supported input type."),
};

Positional pattern

You use a positional pattern to deconstruct an expression result and match the resulting values against the corresponding nested patterns.

public readonly struct Point
{
    public int X { get; }
    public int Y { get; }

    public Point(int x, int y) => (X, Y) = (x, y);
    public void Deconstruct(out int x, out int y) => (x, y) = (X, Y);
}

static string Classify(Point point) => point switch
{
    (0, 0) => "Origin",
    (1, 0) => "positive X basis end",
    (0, 1) => "positive Y basis end",
    _ => "Just a point",
};

At the preceding example, the type of an expression contains the Deconstruct method, which is used to deconstruct an expression result. You can also match expressions of tuple types against positional patterns. In that way, you can match multiple inputs against various patterns:

static decimal GetGroupTicketPriceDiscount(int groupSize, DateTime visitDate)
    => (groupSize, visitDate.DayOfWeek) switch
    {
        (<= 0, _) => throw new ArgumentException("Group size must be positive."),
        (_, DayOfWeek.Saturday or DayOfWeek.Sunday) => 0.0m,
        (>= 5 and < 10, DayOfWeek.Monday) => 20.0m,
        (>= 10, DayOfWeek.Monday) => 30.0m,
        (>= 5 and < 10, _) => 12.0m,
        (>= 10, _) => 15.0m,
        _ => 0.0m,
    };

List patterns

int[] numbers = { 1, 2, 3 };

numbers is [1, 2, 3]; //true
numbers is [1, 2, 4]; //false
numbers is [1, 2, 3, 4]; //false
numbers is [0 or 1, <= 2, >= 3]; //true

To match elements only at the start or/and the end of an input sequence, use the slice pattern (..); A slice pattern matches zero or more elements. You can use at most one slice pattern in a list pattern. The slice pattern can only appear in a list pattern.

new[] { 1, 2, 3, 4, 5 } is [> 0, > 0, ..];  // True
new[] { 1, 1 } is [_, _, ..];  // True
new[] { 0, 1, 2, 3, 4 } is [> 0, > 0, ..];  // False
new[] { 1 } is [1, 2, ..];  // False

new[] { 1, 2, 3, 4 } is [.., > 0, > 0];  // True
new[] { 2, 4 } is [.., > 0, 2, 4];  // False
new[] { 2, 4 } is [.., 2, 4];  // True

new[] { 1, 2, 3, 4 } is [>= 0, .., 2 or 4];  // True
new[] { 1, 0, 0, 1 } is [1, 0, .., 0, 1];  // True
new[] { 1, 0, 1 } is [1, 0, .., 0, 1];  // False

I/O

#direction: right [MarshalByRefObject|Enables access to objects across application domain boundaries in applications that support remoting.] [Stream|Provides a generic view of a sequence of bytes. This is an abstract class.] [BufferedStream|Adds a buffering layer to read and write operations on another stream. This class cannot be inherited.] [BrotliStream|Provides methods and properties used to compress and decompress streams by using the Brotli data format specification.] [DeflateStream |Provides methods and properties for compressing and decompressing streams by using the Deflate algorithm.] [GZipStream|Provides methods and properties used to compress and decompress streams by using the GZip data format specification.] [ZLibStream|Provides methods and properties used to compress and decompress streams by using the zlib data format specification.] [FileStream|Provides a Stream for a file, supporting both synchronous and asynchronous read and write operations.] [MemoryStream|Creates a stream whose backing store is memory] [PipeStream|Exposes a Stream object around a pipe, which supports both anonymous and named pipes.] [UnmanagedMemoryStream|Provides access to unmanaged blocks of memory from managed code.] [NetworkStream|Provides the underlying stream of data for network access.] [CryptoStream|Defines a stream that links data streams to cryptographic transformations.] [MarshalByRefObject] <:- [Stream] [IAsyncDisposable] <:-- [Stream] [IDisposable] <:-- [Stream] [Stream] <:- [BufferedStream] [Stream] <:- [BrotliStream] [Stream] <:- [DeflateStream] [Stream] <:- [GZipStream] [Stream] <:- [ZLibStream] [Stream] <:- [FileStream] [Stream] <:- [MemoryStream] [Stream] <:- [PipeStream] [Stream] <:- [UnmanagedMemoryStream] [Stream] <:- [NetworkStream] [Stream] <:- [CryptoStream] MarshalByRefObject Enables access to objects across application domain boundaries in applications that support remoting. Stream Provides a generic view of a sequence of bytes. This is an abstract class. BufferedStream Adds a buffering layer to read and write operations on another stream. This class cannot be inherited. BrotliStream Provides methods and properties used to compress and decompress streams by using the Brotli data format specification. DeflateStream Provides methods and properties for compressing and decompressing streams by using the Deflate algorithm. GZipStream Provides methods and properties used to compress and decompress streams by using the GZip data format specification. ZLibStream Provides methods and properties used to compress and decompress streams by using the zlib data format specification. FileStream Provides a Stream for a file, supporting both synchronous and asynchronous read and write operations. MemoryStream Creates a stream whose backing store is memory PipeStream Exposes a Stream object around a pipe, which supports both anonymous and named pipes. UnmanagedMemoryStream Provides access to unmanaged blocks of memory from managed code. NetworkStream Provides the underlying stream of data for network access. CryptoStream Defines a stream that links data streams to cryptographic transformations. IAsyncDisposable IDisposable

#direction: right [MarshalByRefObject|Enables access to objects across application domain boundaries in applications that support remoting.] [TextWriter|Represents a writer that can write a sequential series of characters. This class is abstract.] [TextReader|Represents a reader that can read a sequential series of characters.] [StreamReader|Implements a TextReader that reads characters from a byte stream in a particular encoding.] [StringReader|Implements a TextReader that reads from a string.] [StreamWriter|Implements a TextWriter for writing characters to a stream ina particular encoding.] [StringWriter|Implements a TextWriter for writing information to a string. The information is stored in an underlying StringBuilder.] [BinaryReader|Reads primitive data types as binary values in a specific encoding.] [BinaryWriter|Writes primitive types in binary to a stream and supports writing strings in a specific encoding.] [MarshalByRefObject] <:- [TextReader] [IDisposable] <:-- [TextReader] [MarshalByRefObject] <:- [TextWriter] [IAsyncDisposable] <:-- [TextWriter] [IDisposable] <:-- [TextWriter] [IDisposable] <:-- [BinaryReader] [IDisposable] <:-- [BinaryWriter] [TextReader] <:- [StreamReader] [TextReader] <:- [StringReader] [TextWriter] <:- [StreamWriter] [TextWriter] <:- [StringWriter] MarshalByRefObject Enables access to objects across application domain boundaries in applications that support remoting. TextWriter Represents a writer that can write a sequential series of characters. This class is abstract. TextReader Represents a reader that can read a sequential series of characters. StreamReader Implements a TextReader that reads characters from a byte stream in a particular encoding. StringReader Implements a TextReader that reads from a string. StreamWriter Implements a TextWriter for writing characters to a stream ina particular encoding. StringWriter Implements a TextWriter for writing information to a string. The information is stored in an underlying StringBuilder. BinaryReader Reads primitive data types as binary values in a specific encoding. BinaryWriter Writes primitive types in binary to a stream and supports writing strings in a specific encoding. IDisposable IAsyncDisposable

Attributes

#direction: right #spacing: 10 #gravity: .8 [Attribute|Represents the base class for custom attributes.] [AttributeUsageAttribute|Specifies the usage of another attribute class. This class cannot be inherited.] [ThreadStaticAttribute| Indicates that the value of a static field is unique for each thread.] [FlagsAttribute|Indicates that an enumeration can be treated as a bit field\; that is, a set of flags.] [Attribute] - [<note>Serialization Related] - [SerializableAttribute|Indicates that a class can be serialized using binary or XML serialization. This class cannot be inherited.] [Attribute] - [<note>Threading Related] [<note>Serialization Related] - [NonSerializedAttribute|Indicates that a field of a serializable class should not be serialized. This class cannot be inherited.] [<note>Threading Related] - [STAThreadAttribute|Indicates that the COM threading model for an application is single-threaded apartment (STA).] [<note>Threading Related] - [MTAThreadAttribute|Indicates that the COM threading model for an application is multithreaded apartment (MTA).] [<note>Threading Related] - [ThreadStaticAttribute] [Attribute] - [AttributeUsageAttribute] [Attribute] - [FlagsAttribute] [Attribute] - [<note>Development related] - [ObsoleteAttribute|Marks the program elements that are no longer in use. This class cannot be inherited.] [<note>Development related] - [CallerMemberNameAttribute|Allows you to obtain the method or property name of the caller to the method.] [<note>Development related] - [CallerLineNumberAttribute|Allows you to obtain the line number in the source file at which the method is called.] [<note>Development related] - [CallerFilePathAttribute|Allows you to obtain the full path of the source file that contains the caller. This is the file path at the time of compile.] [<note>Development related] - [CallerArgumentExpressionAttribute|Indicates that a parameter captures the expression passed for another parameter as a string.] Attribute Represents the base class for custom attributes. AttributeUsageAttribute Specifies the usage of another attribute class. This class cannot be inherited. ThreadStaticAttribute Indicates that the value of a static field is unique for each thread. FlagsAttribute Indicates that an enumeration can be treated as a bit field; that is, a set of flags. Serialization Related SerializableAttribute Indicates that a class can be serialized using binary or XML serialization. This class cannot be inherited. Threading Related NonSerializedAttribute Indicates that a field of a serializable class should not be serialized. This class cannot be inherited. STAThreadAttribute Indicates that the COM threading model for an application is single-threaded apartment (STA). MTAThreadAttribute Indicates that the COM threading model for an application is multithreaded apartment (MTA). Development related ObsoleteAttribute Marks the program elements that are no longer in use. This class cannot be inherited. CallerMemberNameAttribute Allows you to obtain the method or property name of the caller to the method. CallerLineNumberAttribute Allows you to obtain the line number in the source file at which the method is called. CallerFilePathAttribute Allows you to obtain the full path of the source file that contains the caller. This is the file path at the time of compile. CallerArgumentExpressionAttribute Indicates that a parameter captures the expression passed for another parameter as a string.

Data annotation

#direction: right #spacing: 10 #gravity: .8 [Attribute|Represents the base class for custom attributes.] [ValidationAttribute|Serves as the base class for all validation attributes.] [DisplayAttribute|Provides a general-purpose attribute that lets you specify localizable strings for types and members of entity partial classes.] [DisplayFormatAttribute|Specifies how data fields are displayed and formatted by ASP.NET Dynamic Data.] [Attribute] - [ValidationAttribute] [Attribute] - [DisplayAttribute] [Attribute] - [DescriptionAttribute] [Attribute] - [DisplayFormatAttribute] [DescriptionAttribute|Specifies a description for a property or event.] [ValidationAttribute] - [AllowedValuesAttribute|Specifies a list of values that should be allowed in a property.] [ValidationAttribute] - [Base64StringAttribute|Specifies that a data field value is a well-formed Base64 string.] [ValidationAttribute] - [CompareAttribute|Provides an attribute that compares two properties.] [ValidationAttribute] - [CustomValidationAttribute|Specifies a custom validation method that is used to validate a property or class instance.] [ValidationAttribute] - [DeniedValuesAttribute|Specifies a list of values that should not be allowed in a property.] [ValidationAttribute] - [LengthAttribute|Specifies the minimum and maximum length of collection/string data allowed in a property.] [ValidationAttribute] - [MaxLengthAttribute|Specifies the maximum length of array or string data allowed in a property.] [ValidationAttribute] - [MinLengthAttribute|Specifies the minimum length of array or string data allowed in a property.] [ValidationAttribute] - [RangeAttribute|Specifies the numeric range constraints for the value of a data field.] [ValidationAttribute] - [RegularExpressionAttribute|Specifies that a data field value in ASP.NET Dynamic Data must match the specified regular expression.] [ValidationAttribute] - [StringLengthAttribute|Specifies the minimum and maximum length of characters that are allowed in a data field.] [ValidationAttribute] - [DataTypeAttribute|Specifies the name of an additional type to associate with a data field.] [DataTypeAttribute] - [CreditCardAttribute|Specifies that a data field value is a credit card number.] [DataTypeAttribute] - [EmailAddressAttribute|Validates an email address.] [DataTypeAttribute] - [EnumDataTypeAttribute|Enables a .NET enumeration to be mapped to a data column.] [DataTypeAttribute] - [FileExtensionsAttribute|Validates file name extensions] [DataTypeAttribute] - [PhoneAttribute|Specifies that a data field value is a well-formed phone number.] [DataTypeAttribute] - [UrlAttribute|Provides URL validation.] Attribute Represents the base class for custom attributes. ValidationAttribute Serves as the base class for all validation attributes. DisplayAttribute Provides a general-purpose attribute that lets you specify localizable strings for types and members of entity partial classes. DisplayFormatAttribute Specifies how data fields are displayed and formatted by ASP.NET Dynamic Data. DescriptionAttribute Specifies a description for a property or event. AllowedValuesAttribute Specifies a list of values that should be allowed in a property. Base64StringAttribute Specifies that a data field value is a well-formed Base64 string. CompareAttribute Provides an attribute that compares two properties. CustomValidationAttribute Specifies a custom validation method that is used to validate a property or class instance. DeniedValuesAttribute Specifies a list of values that should not be allowed in a property. LengthAttribute Specifies the minimum and maximum length of collection/string data allowed in a property. MaxLengthAttribute Specifies the maximum length of array or string data allowed in a property. MinLengthAttribute Specifies the minimum length of array or string data allowed in a property. RangeAttribute Specifies the numeric range constraints for the value of a data field. RegularExpressionAttribute Specifies that a data field value in ASP.NET Dynamic Data must match the specified regular expression. StringLengthAttribute Specifies the minimum and maximum length of characters that are allowed in a data field. DataTypeAttribute Specifies the name of an additional type to associate with a data field. CreditCardAttribute Specifies that a data field value is a credit card number. EmailAddressAttribute Validates an email address. EnumDataTypeAttribute Enables a .NET enumeration to be mapped to a data column. FileExtensionsAttribute Validates file name extensions PhoneAttribute Specifies that a data field value is a well-formed phone number. UrlAttribute Provides URL validation.

Cryptography

Encryption Algortithms

#spacing: 12 #direction: right [SymmetricAlgorithm| Represents the abstract base class from which all implementations of symmetric algorithms must inherit.] [Aes| Represents the abstract base class from which all implementations of the Advanced Encryption Standard (AES) must inherit.] [DES| Represents the base class for the Data Encryption Standard (DES) algorithm from which all DES implementations must derive.] [RC2| Represents the base class from which all implementations of the RC2 algorithm must derive.] [TripleDES| Represents the base class for Triple Data Encryption Standard algorithms from which all TripleDES implementations must derive.] [AsymmetricAlgorithm| Represents the abstract base class from which all implementations of asymmetric algorithms must inherit.] [DSA| Represents the abstract base class from which all implementations of the Digital Signature Algorithm (DSA) must inherit.] [ECAlgorithm| Represents the abstract class from which elliptic-curve asymmetric algorithms can inherit.] [RSA| Represents the base class from which all implementations of the RSA algorithm inherit.] [ECDiffieHellman| Provides an abstract base class that Elliptic Curve Diffie-Hellman (ECDH) algorithm implementations can derive from. ] [ECDsa| Provides an abstract base class that encapsulates the Elliptic Curve Digital Signature Algorithm (ECDSA).] [SymmetricAlgorithm] <:- [Aes] [SymmetricAlgorithm] <:- [DES] [SymmetricAlgorithm] <:- [RC2] [SymmetricAlgorithm] <:- [TripleDES] [AsymmetricAlgorithm] <:- [RSA] [AsymmetricAlgorithm] <:- [DSA] [AsymmetricAlgorithm] <:- [ECAlgorithm] [ECAlgorithm] <:- [ECDiffieHellman] [ECAlgorithm] <:- [ECDsa] SymmetricAlgorithm Represents the abstract base class from which all implementations of symmetric algorithms must inherit. Aes Represents the abstract base class from which all implementations of the Advanced Encryption Standard (AES) must inherit. DES Represents the base class for the Data Encryption Standard (DES) algorithm from which all DES implementations must derive. RC2 Represents the base class from which all implementations of the RC2 algorithm must derive. TripleDES Represents the base class for Triple Data Encryption Standard algorithms from which all TripleDES implementations must derive. AsymmetricAlgorithm Represents the abstract base class from which all implementations of asymmetric algorithms must inherit. DSA Represents the abstract base class from which all implementations of the Digital Signature Algorithm (DSA) must inherit. ECAlgorithm Represents the abstract class from which elliptic-curve asymmetric algorithms can inherit. RSA Represents the base class from which all implementations of the RSA algorithm inherit. ECDiffieHellman Provides an abstract base class that Elliptic Curve Diffie-Hellman (ECDH) algorithm implementations can derive from. ECDsa Provides an abstract base class that encapsulates the Elliptic Curve Digital Signature Algorithm (ECDSA).

Symmetric encryption

Symmetric encryption is a cryptographic method where the same key is used for both encryption and decryption of data. In other words, the sender and the recipient use a shared secret key to encrypt and decrypt messages. It is commonly used in various applications, including securing data transmission over networks, encrypting files stored on disk, and protecting sensitive information in databases.

Asymmetric encryption

Asymmetric encryption, also known as public-key cryptography, is a cryptographic method that uses two separate keys for encryption and decryption. A public, and a private key. The pair of keys are mathematically related, but distinct. It is widely used in various applications, including secure Communication, digital signatures and key exchange.

Hash Algorithms

#spacing: 12 #direction: right [<note>Note: SHA3 is only available on .NET 8 or newer versions ] [HashAlgorithm| Represents the base class from which all implementations of cryptographic hash algorithms must derive.] [KeyedHashAlgorithm| Represents the abstract class from which all implementations of keyed hash algorithms must derive.] [HMAC| Represents the abstract class from which all implementations of Hash-based Message AuthenticationCode (HMAC) must derive.] [MACTripleDES| Computes a Message Authentication Code (MAC) using TripleDES for the input data CryptoStream.] [HashAlgorithm] <:- [MD5] [HashAlgorithm] <:- [RIPEMD160] [HashAlgorithm] <:- [SHA1] [HashAlgorithm] <:- [SHA256] [HashAlgorithm] <:- [SHA384] [HashAlgorithm] <:- [SHA512] [HashAlgorithm] <:- [SHA3_256] [HashAlgorithm] <:- [SHA3_384] [HashAlgorithm] <:- [SHA3_512] [HashAlgorithm] <:- [KeyedHashAlgorithm] [KeyedHashAlgorithm] <:- [HMAC] [KeyedHashAlgorithm] <:-[MACTripleDES] [HMAC] <:- [HMACMD5] [HMAC] <:- [HMACRIPEMD160] [HMAC] <:- [HMACSHA1] [HMAC] <:- [HMACSHA256] [HMAC] <:- [HMACSHA384] [HMAC] <:- [HMACSHA512] [HMAC] <:- [HMACSHA3_256] [HMAC] <:- [HMACSHA3_384] [HMAC] <:- [HMACSHA3_512] Note: SHA3 is only available on .NET 8 or newer versions HashAlgorithm Represents the base class from which all implementations of cryptographic hash algorithms must derive. KeyedHashAlgorithm Represents the abstract class from which all implementations of keyed hash algorithms must derive. HMAC Represents the abstract class from which all implementations of Hash-based Message AuthenticationCode (HMAC) must derive. MACTripleDES Computes a Message Authentication Code (MAC) using TripleDES for the input data CryptoStream. MD5 RIPEMD160 SHA1 SHA256 SHA384 SHA512 SHA3_256 SHA3_384 SHA3_512 HMACMD5 HMACRIPEMD160 HMACSHA1 HMACSHA256 HMACSHA384 HMACSHA512 HMACSHA3_256 HMACSHA3_384 HMACSHA3_512

Hash Algorithms

A hash algorithm, also known as a cryptographic hash function, is a mathematical algorithm that takes an input (or "message") and produces a fixed-size string of bytes, which are typically represented as a hexadecimal number or it is base64 encoded.

Hash algorithms have several important properties: They are deterministic. For a given input, the hash algorithm always produces the same output and given a hash value, it should be computationally infeasible to determine the original input.

A cryptographic hash function is resilient to collision. It should be extremely unlikely for two different inputs to produce the same hash value. This property is crucial for ensuring the integrity of data. Even a small change in the input should result in a significantly different hash value.

Hash algorithms are widely used in cryptography for various purposes, including data integrity checks, digital signatures and password storage.

It's worth noting that while MD5 and SHA-1 were once widely used, they are now considered vulnerable to various attacks, and it's generally recommended to use stronger hash functions such as SHA-256 or SHA-3 for cryptographic purposes.

HMAC

Hash-based Message Authentication Code (HMAG), is a mechanism for generating a cryptographic hash of data in combination with a secret key. It provides a way to verify both the integrity and authenticity of a message.

HMAC takes two inputs - the message to be authenticated and a secret key known only to the sender and the receiver. It uses a cryptographic hash function (such as MD5, SHA-1, SHA-256) to process the message. The secret key is mixed with the message in a specific way, usually by XOR operations and padding, to create a unique digest. The mixed data is then hashed using the chosen hash function and the output of the hash function is the HMAC.

The recipient, who knows the secret key, can generate the HMAC using the received message and compare it to the transmitted HMAC. If they match, it indicates that the message has not been tampered with during transmission and that it was sent by someone with knowledge of the secret key.

UI

MVVM

The MVVM pattern helps cleanly separate an application's business and presentation logic from its user interface (UI). Maintaining a clean separation between application logic and the UI helps address numerous development issues and makes an application easier to test, maintain, and evolve. It can also significantly improve code re-use opportunities and allows developers and UI designers to collaborate more easily when developing their respective parts of an app.

Frameworks:

#direction: right #spacing: 12 #arrowSize: 5 [<actor> User] <- [<label>interacts] -> [<transceiver>View] [<transceiver>View Model] [<transceiver>Model] [<note>Implements the INotifyPropertyChanged interface] -- [View Model] [View] -- [<note>Binding is possible to Dependency properties of Controls] [<transceiver>Binding] [View] <- [<label>Updates view]- [<reference>Binding] <- [<label>Observes View Model] - [View Model] [View] -[<label>Dependency Property changes updae it]-> [<reference>Binding] - [<label>Updates]-> [View Model] [View Model] <-[<label>Reads model]- [Model] [View Model] - [<label>Updates model] -> [Model] [<note>May include an optional converter that is either an IValueConverter or IMultiValueConverter instance] -- [Binding] User interacts View View Model Model Implements the INotifyPropertyChanged interface Binding is possible to Dependency properties of Controls Binding Updates view Observes View Model Dependency Property changes updae it Updates Reads model Updates model May include an optional converter that is either an IValueConverter or IMultiValueConverter instance

Minimal MVVM Implementation

public abstract class ViewModelBase : INotifyPropertyChanged
{
    public event PropertyChangedEventHandler? PropertyChanged;

    protected void OnPropertyChanged(string propertyName = "") 
        => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));

    protected void SetValue<T>(ref T field,
                               T newValue,
                               [CallerMemberName] string properyName = "")
    {
        if (!EqualityComparer<T>.Default.Equals(field, newValue))
        {
            field = newValue;
            OnPropertyChanged(properyName);
        }
    }

    protected void SetValue<T>(ref T field,
                               T newValue,
                               IEqualityComparer<T> comparer,
                               [CallerMemberName] string properyName = "")
    {
        if (!comparer.Equals(field, newValue))
        {
            field = newValue;
            OnPropertyChanged(properyName);
        }
    }
}
public class RelayCommand : ICommand
{
    private readonly Action<object?> _acton;
    private readonly Predicate<object?>? _canExecute;

    public event EventHandler? CanExecuteChanged;

    public RelayCommand(Action<object?> acton, Predicate<object?>? canExecute = null)
    {
        _acton = acton;
        _canExecute = canExecute;
    }

    public void RaiseCanExecuteChanged()
        => CanExecuteChanged?.Invoke(this, EventArgs.Empty);

    public bool CanExecute(object? parameter)
        => _canExecute == null || _canExecute(parameter);

    public void Execute(object? parameter)
        => _acton.Invoke(parameter);
}

WPF class hierarchy

#.box: fill=#C06EF0 [Object ] <:- [<box>DispatcherObject] <:- [DependencyObject] <:- [Visual] <:- [UIElement] <:- [<box>FrameworkElement] <:- [<box>Control] [DependencyObject] <:- [Freezable] <- [<box>Animatable] [Visual] <:- [Viewport3DVisual] [Visual] <:- [Visual3D] [Visual3D] <:- [ModelVisual3D] [Visual3D] <:- [Viewport2DVisual3D] [Visual3D] <:- [UIElement3D] <:- [ContainerUIElement3D] [Object] <:- [PrintDialog] [Object] <:- [CommonDialog] <:- [CommonItemDialog] <:- [FileDialog] <:- [SaveFileDialog] [FileDialog] <:- [OpenFileDialog] [CommonItemDialog] <:- [OpenFolderDialog] Object DispatcherObject DependencyObject Visual UIElement FrameworkElement Control Freezable Animatable Viewport3DVisual Visual3D ModelVisual3D Viewport2DVisual3D UIElement3D ContainerUIElement3D PrintDialog CommonDialog CommonItemDialog FileDialog SaveFileDialog OpenFileDialog OpenFolderDialog

#.box: fill=#C06EF0 [<box>DispatcherObject] <:- [FrameworkTemplate] [FrameworkTemplate] <:- [ControlTemplate] [FrameworkTemplate] <:- [ItemsPanelTemplate] [FrameworkTemplate] <:- [DataTemplate] [DataTemplate] <:- [ItemContainerTemplate] [DataTemplate] <:- [HierarchicalDataTemplate] DispatcherObject FrameworkTemplate ControlTemplate ItemsPanelTemplate DataTemplate ItemContainerTemplate HierarchicalDataTemplate

#direction: right #spacing: 12 #.box: fill=#C06EF0 [<box>Animatable] <:- [Camera] <:- [ProjectionCamera] <:- [PerspectiveCamera] [Animatable] <:- [Geometry3D] <:- [MeshGeometry3D] [Animatable] <:- [Model3D] <:- [Light] <:- [DirectionalLight] [Animatable] <:- [GeneralTransform3D] <:- [Transform3D] [Transform3D] <:- [AffineTransform3D] [Transform3D] <:- [MatrixTransform3D] [Transform3D] <:- [Transform3DGroup] [AffineTransform3D] <:- [RotateTransform3D] [AffineTransform3D] <:- [ScaleTransform3D] [AffineTransform3D] <:- [TranslateTransform3D] [GeneralTransform3D] <:-[GeneralTransform3DGroup] [Animatable] <:- [Material] <:- [MaterialGroup] [Material] <:- [DiffuseMaterial] [Material] <:- [EmissiveMaterial] [Material] <:- [SpecularMaterial] [Model3D] <:- [GeometryModel3D] [Model3D] <:- [Model3DGroup] [ProjectionCamera] <:- [OrthographicCamera] [Light] <:- [PointLightBase] <:- [SpotLight] [Light] <:- [AmbientLight] [PointLightBase] <:- [PointLight] [Animatable] <:-[Brush] <:- [TileBrush] <:- [VisualBrush] [Brush] <:- [BitmapCacheBrush] [TileBrush] <:- [DrawingBrush] [TileBrush] <:- [ImageBrush] [Animatable] <:- [Drawing] [Animatable] <:- [Pen] [Drawing] <:- [DrawingGroup] [Drawing] <:- [GeometryDrawing] [Drawing] <:- [GlyphRunDrawing] [Drawing] <:- [ImageDrawing] [Drawing] <:- [VideoDrawing] [ImageSource] <:- [D3DImage] [ImageSource] <:- [DrawingImage] [Animatable] <:- [ImageSource] <:- [BitmapSource] <:- [BitmapImage] [BitmapSource] <:- [InteropBitmap] [BitmapSource] <:- [BitmapFrame] [BitmapSource] <:- [CachedBitmap] [BitmapSource] <:- [ColorConvertedBitmap] [BitmapSource] <:- [CroppedBitmap] [BitmapSource] <:- [FormatConvertedBitmap] [BitmapSource] <:- [RenderTargetBitmap] [BitmapSource] <:- [TransformedBitmap] [BitmapSource] <:- [WriteableBitmap] [Animatable] <:- [GeneralTransform] [GeneralTransform] <:- [GeneralTransformGroup] [GeneralTransform] <:- [Transform] [Transform] <:- [MatrixTransform] [Transform] <:- [RotateTransform] [Transform] <:- [ScaleTransform] [Transform] <:- [SkewTransform] [Transform] <:- [TranslateTransform] Animatable Camera ProjectionCamera PerspectiveCamera Geometry3D MeshGeometry3D Model3D Light DirectionalLight GeneralTransform3D Transform3D AffineTransform3D MatrixTransform3D Transform3DGroup RotateTransform3D ScaleTransform3D TranslateTransform3D GeneralTransform3DGroup Material MaterialGroup DiffuseMaterial EmissiveMaterial SpecularMaterial GeometryModel3D Model3DGroup OrthographicCamera PointLightBase SpotLight AmbientLight PointLight Brush TileBrush VisualBrush BitmapCacheBrush DrawingBrush ImageBrush Drawing Pen DrawingGroup GeometryDrawing GlyphRunDrawing ImageDrawing VideoDrawing ImageSource D3DImage DrawingImage BitmapSource BitmapImage InteropBitmap BitmapFrame CachedBitmap ColorConvertedBitmap CroppedBitmap FormatConvertedBitmap RenderTargetBitmap TransformedBitmap WriteableBitmap GeneralTransform GeneralTransformGroup Transform MatrixTransform RotateTransform ScaleTransform SkewTransform TranslateTransform


#direction: right #spacing: 12 #.box: fill=#C06EF0 [<box>FrameworkElement] <:- [AccessText] [FrameworkElement] <:- [Popup] [FrameworkElement] <:- [TextBlock] [FrameworkElement] <:- [Decorator] <:- [Border] [FrameworkElement] <:- [Page] [FrameworkElement] <:- [Panel] [FrameworkElement] <:- [Viewport3D] [Decorator] <:- [BulletDecorator] [Decorator] <:- [Viewbox] [Panel] <:- [Canvas] [Panel] <:- [DockPanel] [Panel] <:- [Grid] [Panel] <:- [TabPanel] [Panel] <:- [ToolBarOverflowPanel] [Panel] <:- [UniformGrid] [Panel] <:- [StackPanel] [Panel] <:- [VirtualizingPanel] -[VirtualizingStackPanel] [Panel] <:- [WrapPanel] [VirtualizingPanel] <:- [DataGridCellsPanel] [FrameworkElement] <:- [Shape] <:- [Path] [Shape] <:- [Line] [Shape] <:- [Ellipse] [Shape] <:- [Polygon] [Shape] <:- [Polyline] [Shape] <:- [Rectangle] [FrameworkElement] <:- [MediaElement] [FrameworkElement] <:- [Image] [FrameworkElement] <:- [HwndHost] <:- [ActiveXHost] <:- [WebBrowser] [HwndHost] <:- [WindowsFormsHost] FrameworkElement AccessText Popup TextBlock Decorator Border Page Panel Viewport3D BulletDecorator Viewbox Canvas DockPanel Grid TabPanel ToolBarOverflowPanel UniformGrid StackPanel VirtualizingPanel VirtualizingStackPanel WrapPanel DataGridCellsPanel Shape Path Line Ellipse Polygon Polyline Rectangle MediaElement Image HwndHost ActiveXHost WebBrowser WindowsFormsHost

#direction: right #spacing: 12 #.box: fill=#C06EF0 [ContentControl] <:- [ButtonBase] [ButtonBase] <:- [Button] [ButtonBase] <:- [RepeatButton] [ButtonBase] <:- [ToggleButton] [ToggleButton] <:- [RadioButton] [ToggleButton] <:- [CheckBox] [<box>Control] <:- [ContentControl] [ContentControl] <:- [HeaderedContentControl] <:- [Expander] [HeaderedContentControl] <:- [GroupBox] [ContentControl] <:- [ScrollViewer] [ContentControl] <:- [Window] <:- [NavigationWindow] [ContentControl] <:- [Frame] [ContentControl] <:- [Label] [ContentControl] <:- [ToolTip] [Control] <:- [ItemsControl] <:- [Selector] [Control] <:- [Thumb] <:- [GridSplitter] [Control] <:- [ResizeGrip] [Control] <:- [Separator] [Control] <:- [RangeBase] <:- [ScrollBar] [Control] <:- [TextBoxBase] [Control] <:- [DatePicker] [Control] <:- [Calendar] [TextBoxBase] <:- [TextBox] [TextBoxBase] <:- [RichTextBox] [Control] <:- [PasswordBox] [RangeBase] -[Slider] [RangeBase] <:- [ProgressBar] [Selector] <:- [TabControl] [Selector] <:- [MultiSelector] <:- [DataGrid] [Selector] <:- [ListBox] <:- [ListView] [Selector] <:- [ComboBox] [ItemsControl] <:- [StatusBar] [ItemsControl] <:- [TreeView] [ItemsControl] <:- [HeaderedItemsControl] <:- [ToolBar] [ItemsControl] <:- [MenuBase] <:- [ContextMenu] [MenuBase] <:- [Menu] [Control] <:- [DocumentViewerBase] <:- [DocumentViewer] [DocumentViewerBase] <:-[FlowDocumentPageViewer] [Control] <:- [FlowDocumentReader] [Control] <:- [FlowDocumentScrollViewer] [Control] <:- [StickyNoteControl] ContentControl ButtonBase Button RepeatButton ToggleButton RadioButton CheckBox Control HeaderedContentControl Expander GroupBox ScrollViewer Window NavigationWindow Frame Label ToolTip ItemsControl Selector Thumb GridSplitter ResizeGrip Separator RangeBase ScrollBar TextBoxBase DatePicker Calendar TextBox RichTextBox PasswordBox Slider ProgressBar TabControl MultiSelector DataGrid ListBox ListView ComboBox StatusBar TreeView HeaderedItemsControl ToolBar MenuBase ContextMenu Menu DocumentViewerBase DocumentViewer FlowDocumentPageViewer FlowDocumentReader FlowDocumentScrollViewer StickyNoteControl

Windows Froms class hierarchy

#direction: right #spacing: 12 #.box: fill=#C06EF0 [IDisposable] <:-- [<box>Component] [Object] <:- [MarshalByRefObject] <:- [Component] [MarshalByRefObject] <:- [Brush] [MarshalByRefObject] <:- [Font] [MarshalByRefObject] <:- [FontFamily] [MarshalByRefObject] <:- [Graphics] [MarshalByRefObject] <:- [Icon] [MarshalByRefObject] <:- [Image] [MarshalByRefObject] <:- [Pen] [MarshalByRefObject] <:- [Region] [MarshalByRefObject] <:- [NativeWindow] [MarshalByRefObject] <:- [NumericUpDownAccelerationCollection] [MarshalByRefObject] <:- [OwnerDrawPropertyBag] [MarshalByRefObject] <:- [TreeNode] IDisposable Component Object MarshalByRefObject Brush Font FontFamily Graphics Icon Image Pen Region NativeWindow NumericUpDownAccelerationCollection OwnerDrawPropertyBag TreeNode

#direction: right #spacing: 12 #.box: fill=#C06EF0 [<box>Component] <:- [BindingSource] [Component] <:- [CommonDialog] [CommonDialog] <:- [ColorDialog] [CommonDialog] <:- [FileDialog] [FileDialog] <:- [OpenFileDialog] [FileDialog] <:- [SaveFileDialog] [CommonDialog] <:- [FolderBrowserDialog] [CommonDialog] <:- [FontDialog] [CommonDialog] <:- [PageSetupDialog] [CommonDialog] <:- [PrintDialog] [Component] <:- [BindableComponent] <:- [ToolStripItem] [Component] <:- [Menu] [Menu] <:- [CiontextMenu] [Menu] <:- [MainMenu] [Menu] <:- [MenuItem] [Component] <:- [DataGridColumnStyle] [DataGridColumnStyle] <:- [DataGridBoolColumn] [DataGridColumnStyle] <:- [DataGridTextBoxColumn] [ToolStripItem] <:- [ToolStripButton] [ToolStripItem] <:- [ToolStripControlHost] [ToolStripItem] <:- [ToolStripDropDownItem] [ToolStripItem] <:- [ToolStripLabel] <:- [ToolStripStatusLabel] [ToolStripItem] <:- [ToolStripSeparator] [ToolStripControlHost] <:- [ToolStripComboBox] [ToolStripControlHost] <:- [ToolStripProgressBar] [ToolStripControlHost] <:- [ToolStripTextBox] [ToolStripDropDownItem] <:- [ToolStripDropDownButton] [ToolStripDropDownItem] <:- [ToolStripMenuItem] [ToolStripDropDownItem] <:- [ToolStripSplitButton] [Component] <:- [DataGridTableStyle] [Component] <:- [HelpProvider] [Component] <:- [ImageList] [Component] <:- [NotifyIcon] [Component] <:- [StatusBarPanel] [Component] <:- [Timer] [Component] <:- [<box>Control] Component BindingSource CommonDialog ColorDialog FileDialog OpenFileDialog SaveFileDialog FolderBrowserDialog FontDialog PageSetupDialog PrintDialog BindableComponent ToolStripItem Menu CiontextMenu MainMenu MenuItem DataGridColumnStyle DataGridBoolColumn DataGridTextBoxColumn ToolStripButton ToolStripControlHost ToolStripDropDownItem ToolStripLabel ToolStripStatusLabel ToolStripSeparator ToolStripComboBox ToolStripProgressBar ToolStripTextBox ToolStripDropDownButton ToolStripMenuItem ToolStripSplitButton DataGridTableStyle HelpProvider ImageList NotifyIcon StatusBarPanel Timer Control

#direction: right #spacing: 12 #.box: fill=#C06EF0 [<box>Control] <:- [TabControl] [Control] <:- [ToolBar] [Control] <:- [TrackBar] [Control] <:- [TreeView] [Control] <:- [AxHost] [Control] <:- [DataGridView] [Control] <:- [Chart] [Control] <:- [DateTimePicker] [Control] <:- [GroupBox] [Control] <:- [ElementHost] [Control] <:- [ListView] [Control] <:- [MdiClient] [Control] <:- [MonthCalendar] [Control] <:- [PictureBox] [Control] <:- [PrintPreviewControl] [Control] <:- [ProgressBar] Control TabControl ToolBar TrackBar TreeView AxHost DataGridView Chart DateTimePicker GroupBox ElementHost ListView MdiClient MonthCalendar PictureBox PrintPreviewControl ProgressBar

#direction: right #spacing: 10 #.box: fill=#C06EF0 [<box>Control] <:- [ScrollableControl] [Control] <:- [ButtonBase] [Control] <:- [Label] <:- [LinkLabel] [ButtonBase] -[Button] [ButtonBase] -[CheckBox] [ButtonBase] -[RadioButton] [TextBox] <:- [DataGridTextBox] [TextBox] <:- [DataGridViewTextBoxEditingControl] [ScrollableControl] <:- [ContainerControl] [ScrollableControl] <:- [ComponentTray] [ScrollableControl] <:- [Panel] [ScrollableControl] <:- [ToolStrip] [ToolStrip] <:- [ToolStripDropDown] [ToolStripDropDown] <:- [ToolStripDropDownMenu] <:- [ContextMenuStrip] [ToolStripDropDown] <:- [ToolStripOverflow] [ToolStrip] <:- [BindingNavigator] [ToolStrip] <:- [MenuStrip] [ToolStrip] <:- [StatusStrip] [ContainerControl] <:- [Form] <:- [PrintPreviewDialog] [Form] <:- [ThreadExceptionDialog] [ContainerControl] <:- [PropertyGrid] [ContainerControl] <:- [SplitContainer] [ContainerControl] <:- [ToolStripContainer] [ContainerControl] <:- [ToolStripPanel] [ContainerControl] <:- [UpDownBase] <:- [DomainUpDown] [UpDownBase] <:- [NumericUpDown] [ContainerControl] <:- [UserControl] [Control] <:- [ListControl] <:- [ComboBox] <:- [DataGridViewComboBoxEditingControl] [ListControl] <:- [ListBox] <:- [CheckedListBox] [Control] <:- [TextBoxBase] [TextBoxBase] <:- [MaskedTextBox] [TextBoxBase] <:- [RichTextBox] [TextBoxBase] <:- [TextBox] [ScrollBar] <:- [VScrollBar] [Control] <:- [Splitter] [Control] <:- [StatusBar] [Control] <:- [WebBrowserBase] <:- [WebBrowser] [Panel] <:- [ComponentEditorPage] [Panel] <:- [FlowLayoutPanel] [Panel] <:- [SplitterPanel] [Panel] <:- [TableLayoutPanel] <:- [ByteViewer] [Panel] <:- [TabPage] [Panel] <:- [ToolStripContentPanel] [Control] <:- [ScrollBar] <:- [HScrollBar] Control ScrollableControl ButtonBase Label LinkLabel Button CheckBox RadioButton TextBox DataGridTextBox DataGridViewTextBoxEditingControl ContainerControl ComponentTray Panel ToolStrip ToolStripDropDown ToolStripDropDownMenu ContextMenuStrip ToolStripOverflow BindingNavigator MenuStrip StatusStrip Form PrintPreviewDialog ThreadExceptionDialog PropertyGrid SplitContainer ToolStripContainer ToolStripPanel UpDownBase DomainUpDown NumericUpDown UserControl ListControl ComboBox DataGridViewComboBoxEditingControl ListBox CheckedListBox TextBoxBase MaskedTextBox RichTextBox ScrollBar VScrollBar Splitter StatusBar WebBrowserBase WebBrowser ComponentEditorPage FlowLayoutPanel SplitterPanel TableLayoutPanel ByteViewer TabPage ToolStripContentPanel HScrollBar

MAUI class hierarchy

#direction: right #spacing: 12 #.box: fill=#C06EF0 [BindableObject] <:- [StateTriggerBase] [StateTriggerBase] <:- [AdaptiveTrigger] [StateTriggerBase] <:- [CompareStateTrigger] [StateTriggerBase] <:- [DeviceStateTrigger] [StateTriggerBase] <:- [SpanModeStateTrigger] [StateTriggerBase] <:- [WindowSpanModeStateTrigger] [BindableObject] <:- [TriggerBase] [TriggerBase] <:- [DataTrigger] [TriggerBase] <:- [EventTrigger] [TriggerBase] <:- [MultiTrigger] [TriggerBase] <:- [Trigger] [BindableObject] <:- [<box>Elelement] [BindableObject] <:- [BackButtonBehavior] [BindableObject] <:- [ColumnDefinition] [BindableObject] <:- [ItemsLayout] [ItemsLayout] <:- [GridItemsLayout] [ItemsLayout] <:- [LinearItemsLayout] [BindableObject] <:- [Behavior] <:- [Behavior\<T\>] <:- [PlatformBehavior \<TView,TPlatformView\>] <:- [PlatformBehavior\<TView\>] [BindableObject] <:- [WebViewSource] [WebViewSource] <:- [HtmlWebViewSource] [WebViewSource] <:- [UrlWebViewSource] [BindableObject] <:- [KeyboardAccelerator] [BindableObject] <:- [RowDefinition] [BindableObject] <:- [SearchHandler] [BindableObject] <:- [PathFigure] [BindableObject] <:- [TableSectionBase] [BindableObject] <:- [Geometry] [Geometry] <:- [EllipseGeometry] [Geometry] <:- [GeometryGroup] [Geometry] <:- [LineGeometry] [Geometry] <:- [PathGeometry] [Geometry] <:- [RectangleGeometry] [BindableObject] <:- [PathSegment] [PathSegment] <:- [ArcSegment] [PathSegment] <:- [BezierSegment] [PathSegment] <:- [LineSegment] [PathSegment] <:- [PolyBezierSegment] [PathSegment] <:- [PolyLineSegment ] [PathSegment] <:- [PolyQuadraticBezierSegment] [PathSegment] <:- [QuadraticBezierSegment] [BindableObject] <:- [Transform] [Transform] <:- [CompositeTransform] [Transform] <:- [MatrixTransform] [Transform] <:- [RotateTransform] [Transform] <:- [ScaleTransform] [Transform] <:- [SkewTransform] [Transform] <:- [TransformGroup] [Transform] <:- [TranslateTransform] BindableObject StateTriggerBase AdaptiveTrigger CompareStateTrigger DeviceStateTrigger SpanModeStateTrigger WindowSpanModeStateTrigger TriggerBase DataTrigger EventTrigger MultiTrigger Trigger Elelement BackButtonBehavior ColumnDefinition ItemsLayout GridItemsLayout LinearItemsLayout Behavior Behavior<T> PlatformBehavior <TView,TPlatformView> PlatformBehavior<TView> WebViewSource HtmlWebViewSource UrlWebViewSource KeyboardAccelerator RowDefinition SearchHandler PathFigure TableSectionBase Geometry EllipseGeometry GeometryGroup LineGeometry PathGeometry RectangleGeometry PathSegment ArcSegment BezierSegment LineSegment PolyBezierSegment PolyLineSegment PolyQuadraticBezierSegment QuadraticBezierSegment Transform CompositeTransform MatrixTransform RotateTransform ScaleTransform SkewTransform TransformGroup TranslateTransform

#direction: right #spacing: 12 #.box: fill=#C06EF0 [Element] <:- [Application] [Element] <:- [AppLinkEntry] [Element] <:- [BaseMenuItem] [Element] <:- [Brush] [Brush] <:- [GradientBrush] [GradientBrush] <:- [LinearGradientBrush] [GradientBrush] <:- [RadialGradientBrush] [Brush] <:- [SolidColorBrush] [Element] <:- [FlyoutBase] <:- [MenuFlyout] [Element] <:- [FormattedString] [Element] <:- [GestureElement] <:- [Span] [Element] <:- [GestureRecognizer] [GestureRecognizer] <:-[DragGestureRecognizer] [GestureRecognizer] <:-[DropGestureRecognizer] [GestureRecognizer] <:-[PanGestureRecognizer] [GestureRecognizer] <:-[PinchGestureRecognizer] [GestureRecognizer] <:-[PointerGestureRecognizer] [GestureRecognizer] <:-[SwipeGestureRecognizer] [GestureRecognizer] <:-[TapGestureRecognizer] [Element] <:- [GradientStop] [Element] <:- [ImageSource] [ImageSource] <:- [FileImageSource] [ImageSource] <:- [FontImageSource] [ImageSource] <:- [StreamImageSource] [ImageSource] <:- [UriImageSource] [Element] <:- [MapElement] [MapElement] <:- [Circle] [MapElement] <:- [Polygon] [MapElement] <:- [Polyline] [Element] <:- [Pin] [Element] <:- [MenuBar] [Element] <:- [Shadow] [Element] <:- [SwipeItems] [Element] <:- [<box>NavigableElement] [Element] <:-[BaseMenuItem] <:- [MenuBarItem] [BaseMenuItem] <:- [MenuItem] [MenuItem] <:- [MenuFlyoutItem] [MenuFlyoutItem] <:- [MenuFlyoutSeparator] [MenuFlyoutItem] <:- [MenuFlyoutSubItem] [MenuItem] <:- [SwipeItem] [MenuItem] <:- [ToolbarItem] [Element] <:- [Cell] [Cell] <:- [EntryCell] [Cell] <:- [SwitchCell] [Cell] <:- [TextCell] [Cell] <:- [ViewCell] [Element] <:- [<box>NavigableElement] Element Application AppLinkEntry BaseMenuItem Brush GradientBrush LinearGradientBrush RadialGradientBrush SolidColorBrush FlyoutBase MenuFlyout FormattedString GestureElement Span GestureRecognizer DragGestureRecognizer DropGestureRecognizer PanGestureRecognizer PinchGestureRecognizer PointerGestureRecognizer SwipeGestureRecognizer TapGestureRecognizer GradientStop ImageSource FileImageSource FontImageSource StreamImageSource UriImageSource MapElement Circle Polygon Polyline Pin MenuBar Shadow SwipeItems NavigableElement MenuBarItem MenuItem MenuFlyoutItem MenuFlyoutSeparator MenuFlyoutSubItem SwipeItem ToolbarItem Cell EntryCell SwitchCell TextCell ViewCell

#direction: right #spacing: 12 #.box: fill=#C06EF0 [NavigableElement] <:- [Window] [NavigableElement] <:- [BaseShellItem] [BaseShellItem] <:- [ShellContent] [BaseShellItem] <:- [ShellGroupItem] [ShellGroupItem] <:- [ShellItem] [ShellItem] <:- [FlyoutItem] [ShellItem] <:- [TabBar] [ShellGroupItem] <:- [ShellSection] [NavigableElement] <:- [VisualElement] [VisualElement] <:- [Page] [Page] <:- [FlyoutPage] [Page] <:- [MultiPage\<T\>] [Page] <:- [NavigationPage] [Page] <:- [Shell] [Page] <:- [TemplatedPage] [VisualElement] <:- [<box id=b>View] [<box>View] <:- [BlazorWebView] [View] <:- [ActivityIndicator] [View] <:- [Border] [View] <:- [BoxView] [View] <:- [Button] [View] <:- [CheckBox] [View] <:- [DatePicker] [View] <:- [GraphicsView] [View] <:- [Image] [View] <:- [ImageButton] [View] <:- [InputView] [InputView] <:-[Editor] [InputView] <:-[Entry] [InputView] <:-[SearchBar] [View] <:- [ItemsView] [ItemsView] <:- [CarouselView] [ItemsView] <:- [StructuredItemsView] <:- [SelectableItemsView] [SelectableItemsView] <:- [GroupableItemsView] [GroupableItemsView] <:- [ReorderableItemsView] [View] <:- [ItemsView\<TVisual\>] <:- [ListView] [View] <:- [Layout] [Layout] <:- [AbsoluteLayout] [Layout] <:- [FlexLayout] [Layout] <:- [Grid] [Layout] <:- [StackBase] [StackBase] <:- [HorizontalStackLayout] [StackBase] <:- [StackLayout] [StackBase] <:- [VerticalStackLayout] [View] <:- [Label] [View] <:- [Picker] [View] <:- [ProgressBar] [View] <:- [Shape] [Shape] <:-[Ellipse] [Shape] <:-[Line] [Shape] <:-[Path] [Shape] <:-[Polygon] [Shape] <:-[Polyline] [Shape] <:-[Rectangle] [Shape] <:-[RoundRectangle] [View] <:- [Slider] [View] <:- [Stepper] [View] <:- [Switch] [View] <:- [TableView] [View] <:- [TimePicker] [View] <:- [WebView] NavigableElement Window BaseShellItem ShellContent ShellGroupItem ShellItem FlyoutItem TabBar ShellSection VisualElement Page FlyoutPage MultiPage<T> NavigationPage Shell TemplatedPage View View BlazorWebView ActivityIndicator Border BoxView Button CheckBox DatePicker GraphicsView Image ImageButton InputView Editor Entry SearchBar ItemsView CarouselView StructuredItemsView SelectableItemsView GroupableItemsView ReorderableItemsView ItemsView<TVisual> ListView Layout AbsoluteLayout FlexLayout Grid StackBase HorizontalStackLayout StackLayout VerticalStackLayout Label Picker ProgressBar Shape Ellipse Line Path Polygon Polyline Rectangle RoundRectangle Slider Stepper Switch TableView TimePicker WebView

Useful NuGet packages