w3school
C#data type
e refers to power to 10
for example
5.75D2f -> f refers to float
here it means 5.75 *100=575
C# type conversion
Console.WriteLine(myInt.ToString());
Console.WriteLine(myInt.ToInt());
Console.WriteLine(myInt.Double);
Console.WriteLine(myInt.ToString());
Console.WriteLine(Convert.ToInt32(myDouble));
Console.WriteLine(Convert.ToString(myInt)); // Convert int to string
Console.WriteLine(Convert.ToDouble(myInt));
C# String
txt.Length;
txt.ToUpper();
Txt.Lower();
String.Concat(firstName, LastName);
string Interpolation
string firstName=rajan;
string lastName=khadka;
string name=$"My full name is: {firstName} and Last name is:{lastName}";
Access String
string s = "Hello";
Console.WriteLine(s.[0]);
This prints H
s.IndexOf("e"); gives index number
Substring cuts the string from one point to another
string another="Rajan Khadka";
Console.WriteLine(another.Substring(0,another.IndexOf("K")));
Console.WriteLine(another.Substring(another.IndexOf("K")));
Console.WriteLine(another.Substring(another.IndexOf("K"),4));
to use c# inbuild code as real string in c#
we need to specify \
\' ' Single quote
\" " Double quote
\\ \ Backslash
Comments
Post a Comment