public class Person : INotifyPropertyChanged { private string _name; public string Name { get { return _name; } set { if (_name != value) { _name = value; OnPropertyChanged(nameof(Name)); } } } public event PropertyChangedEventHandler PropertyChanged; protected virtual void OnPropertyChanged(string propertyName) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } }
public class Person { public string Name { get; set; } public int Age { get; set; } } var person = new Person { Name = "John", Age = 30 }; var typeOfPerson = person.GetType();In the code example above, we have a Person class with two properties: Name and Age. We create an instance of the class and assign it to the person variable. We then use the GetType method to get the type of the object and assign it to the typeOfPerson variable. There is no specific package library for the GetType method as it is part of the C# language and is included in the System.Object class.