var result = new Result { Success = true, ErrorMessage = "", Data = "Hello World" }; string resultString = result.ToString(); Console.WriteLine(resultString);
var failedResult = new Result { Success = false, ErrorMessage = "An error occurred", Data = null }; string failedResultString = failedResult.ToString(); Console.WriteLine(failedResultString);This example creates a failed result with an error message and no data value. The ToString method converts this result to a string and displays it in the console. The System Result ToString method is part of the .NET Framework class library.