Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Csharp Articles
Page 185 of 196
Math.BigMul() Method in C#
The Math.BigMul() method in C# is used to calculate the full product of two 32-bit numbers. The method returns an Int64 integer with the production of both the numbers.SyntaxFollowing is the syntax −public static long BigMul (int val1, int val2);Here, val1 is the 1st number to multiply, whereas val2 is the 2nd number.ExampleLet us now see an example to implement Math.BigMul() method −using System; public class Demo { public static void Main(){ int val1 = Int32.MaxValue; int val2 = Int32.MaxValue; Console.WriteLine("Product of two numbers = " + Math.BigMul(val1, val2)); ...
Read MoreChar.ToString() Method in C#
The Char.ToString() method in C# is used to convert the value of this instance to its equivalent string representation.SyntaxFollowing is the syntax −public override string ToString ();ExampleLet us now see an example to implement the Char.ToString() method −using System; public class Demo { public static void Main(){ char ch = 'p'; Console.WriteLine("Value = "+ch); char res1 = Char.ToLowerInvariant(ch); Console.WriteLine("Lowercase Equivalent = "+res1); string res2 = ch.ToString(); Console.WriteLine("String Equivalent = "+res2); } }OutputThis will produce the following output −Value = p ...
Read MoreChar.ToLowerInvariant(Char) Method in C#
The Char.ToLowerInvariant() method in C# is used to convert the value of a Unicode character to its lowercase equivalent using the casing rules of the invariant culture.OutputFollowing is the syntax −public static char ToLowerInvariant (char ch);Above, the parameter ch is the Unicode character to convert.ExampleLet us now see an example to implement the Char.ToLowerInvariant() method −using System; public class Demo { public static void Main(){ char ch = 'D'; char res = Char.ToLowerInvariant(ch); Console.WriteLine("Value = "+ch); Console.WriteLine("Lowercase Equivalent = "+res); } }OutputThis will produce the following ...
Read MoreChar.Parse(String) Method in C#
The Char.Parse(String) method in C# is used to convert the value of the specified string to its equivalent Unicode character.SyntaxFollowing is the syntax −public static char Parse (string str);Above, the string str is a string that contains a single character or null.ExampleLet us now see an example to implement the Char.Parse(String) method −using System; public class Demo { public static void Main(){ string str ="a"; char res = Char.Parse(str); Console.WriteLine("Value = "+str); Console.WriteLine("Equivalent Unicode character = "+res); } }OutputThis will produce the following output −Value = ...
Read MoreDecimal.ToSingle() Method in C#
The Decimal.ToSingle() method in C# is used to convert the value of the specified Decimal to the equivalent single-precision floating-point number.SyntaxFollowing is the syntax −public static float ToSingle (decimal val);Above, Val is the decimal number to convert.ExampleLet us now see an example to implement the Decimal.ToSingle() method −using System; public class Demo { public static void Main(){ Decimal val = 0.00000007575833m; Console.WriteLine("Decimal value = "+val); float res = Decimal.ToSingle(val); Console.WriteLine("Single-precision floating-point number = "+res); } }OutputThis will produce the following output −Decimal value = 0.00000007575833 Single-precision ...
Read MoreDecimal.ToSByte() Method in C#
The Decimal.ToSByte() method in C# is used to convert the value of the specified Decimal to the equivalent 8-bit signed integer.SyntaxFollowing is the syntax −public static sbyte ToSByte (decimal val);Above, Val is the decimal number to convert.ExampleLet us now see an example to implement the Decimal.ToSByte() method −using System; public class Demo { public static void Main(){ Decimal val = 97.567m; Console.WriteLine("Decimal value = "+val); sbyte res = Decimal.ToSByte(val); Console.WriteLine("SByte value = "+res); } }OutputThis will produce the following output −Decimal value = 97.567 SByte value ...
Read MoreDecimal.ToOACurrency() Method in C#
The Decimal.ToOACurrency() method in C# is used to convert the specified Decimal value to the equivalent OLE Automation Currency value, which is contained in a 64-bit signed integer.SyntaxFollowing is the syntax −public static long ToOACurrency (decimal val);Above, Val is the decimal number to convert.ExampleLet us now see an example to implement the Decimal.ToOACurrency() method −using System; public class Demo { public static void Main(){ Decimal val = 95; Console.WriteLine("Decimal value = "+val); long res = Decimal.ToOACurrency(val); Console.WriteLine("Long value = "+res); } }OutputThis will produce the following ...
Read MoreType.GetEnumValues() Method in C#
The Type.GetEnumValues() method in C# returns an array of the values of the constants in the current enumeration type.SyntaxFollowing is the syntax −public virtual Array GetEnumValues ();ExampleLet us now see an example to implement the Type.GetEnumValues() method −using System; public class Demo { enum Vehicle {Car, Bus, Bike, Airplane} public static void Main(){ try { Type type = typeof(int); string[] str = type.GetEnumNames(); Console.WriteLine("GetEnumNames() to return the constant name = " + str); Type type2 = type.GetEnumUnderlyingType(); ...
Read MoreType.GetEnumUnderlyingType() Method in C#
The Type.GetEnumUnderlyingType() method in C# is used to return the underlying type of the current enumeration type.SyntaxFollowing is the syntax −public virtual Type GetEnumUnderlyingType ();ExampleLet us now see an example to implement the Type.GetEnumUnderlyingType() method −using System; public class Demo { enum Vehicle {Car, Bus, Bike, Airplane} public static void Main(){ try { Vehicle v = Vehicle.Bike; Type type = v.GetType(); string[] str = type.GetEnumNames(); Console.WriteLine("GetEnumName() to return the constant name = " + str); ...
Read MoreType.GetEnumNames() Method in C#
The Type.GetEnumNames() method in C# is used to return the names of the members of the current enumeration type.SyntaxFollowing is the syntax −public virtual string[] GetEnumNames ();ExampleLet us now see an example to implement the Type.GetEnumNames() method −using System; public class Demo { enum Vehicle {Car, Bus, Bike} public static void Main(){ try { Type type = typeof(string); string[] str = type.GetEnumNames(); Console.WriteLine("GetEnumName() to return the constant name = " + str); Console.WriteLine("Listing constants .."); ...
Read More