int num = 10; string strNum = num.ToString(); Console.WriteLine(strNum); // Output: 10
class Employee { public int EmployeeId {get; set;} public string Name {get; set;} public override string ToString() { return $"Employee Id: {EmployeeId}, Name: {Name}"; } } Employee emp = new Employee { EmployeeId = 1, Name = "John" }; Console.WriteLine(emp.ToString()); // Output: Employee Id: 1, Name: JohnIn the above example, the `ToString()` method is overridden in the `Employee` class to return a string representation of the object. The `ToString()` method is part of the `System.Object` class that is included in the .NET Framework, making it available as a library in all C# applications.