Header Ads

Header Ads

how to store different type of data in one varriable

How to use string format method

Friends today i will tell you how to use to string.format method and what is the use of this method
so you follow these step
! open visual studio and then select C# and then select console application and write following code in project you right following code in main method
Here a example
int a =0;
string empname="ravi";
float income="5.36f";
string str=string.format(day left {0}.current date time{1:u}.\n string{2},float{3}",a,Datetime.Now,empname,income);
Console.WriteLine(empname);


Here you change the value according to you that is not compulsory you write this code 

This code is useful for converting any type of data in string format

Thank you


No comments:

Powered by Blogger.