Maha

Maha

  • NA
  • 0
  • 326.5k

NP134 null

Aug 24 2008 11:04 AM

Hi Guys

 

NP134 null

 

In the following program string value is declared as a null. Is there any advantage of declaring string value as a null? Because string is a reference-type variable whereas null is a default value of reference-type variables.      

 

Please explain.

 

Thank you

 

using System;

 

class MainClass

{

    public static void Main(string[] args)

    {

        string formStr = null;

 

        formStr = string.Format("you had {0:C} in your account?", 99989.987);

 

        Console.WriteLine(formStr);

    }

}

/*

you had $99,989.99 in your account?

*/


Answers (2)