Q&A
Ask and answer questions to make information more available to wider audiences.
Judah Alcot @alcotjudah   23, May 2023 12:00 AM
self
What is a self in F#?
answers 2
 
Answer 1
Natalie Jarrett @jarrettnatalie   31, May 2023 12:58 PM
Example:

type Employee(id,name) as this =  
    let id = id  
    let name = name  
    do this.Display()           // This is how we can use self(this) object  
    member this.Display() =  
        printf "%d %s" id name  
let e =new Employee(100, "Rajkumar")  
 
Answer 2
Noah Antills @noahantills   31, May 2023 12:53 PM
In F#, a self is used to refer the current object of class type. Self is the same as this keyword in C# and Java. You can name the self-identifier however you want. You are not restricted to names such as this or self as in .Net languages.