C# 8 Quick Syntax Reference by Mikael Olsson

C# 8 Quick Syntax Reference by Mikael Olsson

Author:Mikael Olsson
Language: eng
Format: epub
ISBN: 9781484255773
Publisher: Apress


The static constructor, in contrast to the regular instance constructor, will only be run once. This occurs automatically either when an instance of the class is created or when a static member of the class is referenced. Static constructors cannot be called directly and are not inherited. In case the static fields also have initializers, those initial values will be assigned before the static constructor is run.

Static Local Functions

A local function automatically captures the context of its enclosing scope, enabling it to reference members outside of itself such as variables local to the parent method.string GetName()

{

string name = "John";

return LocalFunc();

string LocalFunc() { return name; }

}



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.