Samstag, 25. September 2021

BASTA'21 impressions - not only c#10 features... 
-> test c# code on the fly online
-> observe the source code of dot net. Deep dive into the source of dot net. 
-> for alternative layout of; you can also push . when browsing in
-> first class microsoft blogs of ms team leaders, managers, high ranking employees

record struct Vector2d(double X, double Y)
    public static Vector2d operator +(Vector2d first, Vector2d second) =>
        new Vector2d(first.X + second.X, first.Y + second.Y);
-> like normal record but value typed (variable) and not referenced typed (pointer)
-> see

readonly record struct
-> of course - readonly - makes record struct immutable

public string FirstName { get; init; } = "Neo";
-> c# class property set init only
-> read

var v2 = v1 with { X = 4d }; // clone v1 and override double property X with new value of 4d 
-> clones the source to modify it partially
-> see :

4d -> 4.0 double value
4m -> 4.0 decimal value
4f -> 4.0 float value

-> get the name description of the type

-> var x = "my text" is String;
-> predicate operation (true/false result) if object is of type ANY. Here is x true finally.

-> value types are stack allocates and not pushed to the heap
-> see

Span<Vector2d> vectors = stackalloc Vector2d[]
    new Vector2d(3d, 4d),
    new Vector2d(1d, 2d)

-> see

and even more....