Extremely Serious

Month: April 2020 (Page 2 of 2)

Set the SSL Backend to use with Git

To provide which ssl backend to use with git use the following syntax:

git config --global http.sslBackend <SSL_BACKEND>

The SSL_BACKEND token can potentially be openssl or schannel.

schannel uses the windows certicate store.

Example

git config --global http.sslBackend schannel

Verbatim String Literal

A double quoted string prefixed with an at (@) sign symbol will be interpreted verbatim.

Syntax

@"<STRING>"

The STRING token can have simple escaped sequences (e.g. \\ for backslash), hexadecimal escape sequence (i.e. \x<HEX_NUMBER>) and unicode escape sequences (i.e. \u<HEX_NUMBER>) that are interpreted literally. However, the "" will still be escaped an will produce a single double quote mark.

Verbatim string literal and string interpolation can be combined with the syntax as $@"<STRING>". Moreover, the {{ or }} will still be escaped.

Example

var string1 = "C:\\Windows\\System32"
var string2 = @"C:\Windows\System32"

Console.WriteLine(string1)
Console.WriteLine(string2)

The writelines will produce the same output.

String Interpolation

A double quoted string prefixed with a dollar ($) sign symbol can includes interpolation expression.

Syntax

$"<STRING>"

The STRING token can have interpolation expression and has the following syntax:

{<INTERPOLATION_EXPRESSION>[,<ALIGNMENT>][:<FORMAT_STRING>]}
Token Description
INTERPOLATION_EXPRESSION The part that will produce a formatted output.
ALIGNMENT Imposed a minimum number of character. If positive it is right-aligned and if negative it is left-aligned.
FORMAT_STRING A format that is supported by the expression. Find more on here.

If you needed to include { or } in your string output, escape it as {{ or }} respectively on which ever you need.

Example

var name = "World"
var greeting = $"Hello {name}"
Newer posts »