A self-identifier is a name that represents the current instance. It resembles the this keyword in C# or C++ or Me in Visual Basic.
as keyword after the closing parentheses of the constructor parameter list and specify the identifier name.self identifier in the member declaration, just before the method name and a period (.) as a separator.The following example shows two ways to create a self-identifier.
type Point3D(x: int, y: int, z: int) as self =
let X = x
let Y = y
let Z = z
do
self.Print()
member this.Print() =
printf "%d %d %d" x y z
let point = new Point3D(1, 2, 3)
In the first line, the as keyword is used to define the self-identifier. In the seventh line, the identifier this is used to define a self-identifier whose scope is restricted to the method Print.
self, Me, or this.as keyword is not initialized until after the base constructor.let bindings or do bindings.When a self identifier is used before or inside the base constructor, the following exception will be raised during runtime.
System.InvalidOperationException: The initialization of an object or value resulted in an object or value being accessed recursively before it was fully initialized.