Saturday, January 8, 2011

Extended the .NET string.format() Part II

I updated my ExtendedFormat class to support a dictionary, so one can write the following code:
 static  void  Main(string [] args) {
 
     string  format                       = "LastName:{LastName}, FirstName:{FirstName}, Age:{0}" ;
     Dictionary <string , object > Values = new  Dictionary ();
     Values["LastName" ]                  = "TORRES" ;
     Values["FirstName" ]                 = "Frederic" ;
 
     Console.WriteLine(ExtendedFormatNamespace.ExtendedFormat.Format(format, Values, 45));
 }

No comments:

Post a Comment