Fullname to a instance of User without needing to add the method to the User method.Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Use class extensions to add additional logic to a class without modifying the class itself.
class User {
public string Firstname;
public string Lastname;
}
class Extensions {
public string Fullname(this User user) {
return $"{user.Firstname} {user.Lastname}";
}
}
User user;
string name = user.Fullname();
Fullname to a instance of User without needing to add the method to the User method.