Answers for "tostring format in c#"

C#
0

tostring c#

object exampleObject = "hello";
Console.WriteLine(exampleObject.ToString()); //console -> "hello"

string dateTime;
dateTime = DateTime.Now.ToString(); //without .ToString(), editor will return an error
Console.WriteLine(dateTime); //console -> "10/13/2021 19:03:16"
Posted by: Guest on October-13-2021
0

vb.net tostring numeric format string

decimal value = 123.456m;
Console.WriteLine("Your account balance is {0:C2}.", value);
// Displays "Your account balance is $123.46."
Posted by: Guest on May-18-2020

C# Answers by Framework

Browse Popular Code Answers by Language