Welcome to Devintelligence.com Sign in | Join | Help

.Net Adventures

In .Net we trust
Error!
HTTP/1.1 404 Not Found


Aggregated reflection-based ToString() implementation

Instead printing your object's data in ordinary way

string foo = string.Format(

 "My name is {0} {1} and my birthday is {2:MM/dd/yyyy}",

 p.FirstName, p.LastName, p.BirthDate );

you can try another method .It looks more intuitive ...

Person p = new Person( "Scott","Hanselman",new DateTime(1974,1,22) );

string foo =

 p.ToString("My name is {FirstName} {LastName} and my birthday is {Birthdate:MM/dd/yyyy}");

Download FormattableObject 0.5

[ Via ComputerZen.com ]

Posted: Sunday, February 06, 2005 12:08 PM by adventurer

Comments

No Comments

New Comments to this post are disabled