Casting and Converting value to string - CSharp Language Basics

CSharp examples for Language Basics:Data Type Cast

Description

Casting and Converting value to string

Demo Code

using System;/*from   w w w.j  a v  a2s.  c  om*/
using static System.Console;
using static System.Convert;
class Program
{
   static void Main(string[] args)
   {
      int number = 12;
      WriteLine(number.ToString());
      bool boolean = true;
      WriteLine(boolean.ToString());
      DateTime now = DateTime.Now;
      WriteLine(now.ToString());
      object me = new object();
      WriteLine(me.ToString());
   }
}

Result


Related Tutorials