
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 2587 Articles for Csharp

1K+ Views
The Decimal.Truncate() method in C# is used to return the integral digits of the specified Decimal. Remember, any fractional digits are discarded.SyntaxFollowing is the syntax −public static decimal Truncate (decimal val);Above, Val is the decimal number to truncate.ExampleLet us now see an example to implement the Decimal.Truncate() method −using System; public class Demo { public static void Main(){ Decimal val = 6576.876m; Console.WriteLine("Decimal value = "+val); ulong res = Decimal.ToUInt64(val); Console.WriteLine("64-bit unsigned integer = "+res); Decimal val2 = Decimal.Truncate(val); Console.WriteLine("Integral digits ... Read More

46 Views
The Decimal.ToUInt64() method in C# is used to convert the value of the specified Decimal to the equivalent 64-bit unsigned integer.SyntaxFollowing is the syntax −public static ulong ToUInt64 (decimal val);Above, Val is the decimal number to convert.ExampleLet us now see an example to implement the Decimal.ToUInt64() method −using System; public class Demo { public static void Main(){ Decimal val = 99.29m; Console.WriteLine("Decimal value = "+val); ulong res = Decimal.ToUInt64(val); Console.WriteLine("64-bit unsigned integer = "+res); } }OutputThis will produce the following output −Decimal value = 99.29 64-bit ... Read More

68 Views
The Decimal.ToUInt32() method in C# is used to convert the value of the specified Decimal to the equivalent 32-bit unsigned integer.SyntaxFollowing is the syntax −public static uint ToUInt32 (decimal val);Above, Val is the decimal number to convert.ExampleLet us now see an example to implement the Decimal.ToUInt32() method −using System; public class Demo { public static void Main(){ Decimal val = 0.001m; Console.WriteLine("Decimal value = "+val); uint res = Decimal.ToUInt32(val); Console.WriteLine("32-bit unsigned integer = "+res); } }OutputThis will produce the following output −Decimal value = 0.001 32-bit ... Read More

90 Views
The BitConverter.Int64BitsToDouble() method in C# is used to reinterpret the specified 64-bit signed integer to a double-precision floating-point number.SyntaxFollowing is the syntax −public static double Int64BitsToDouble (long val);Above, the parameter value is the number to convert.ExampleLet us now see an example to implement the BitConverter.Int64BitsToDouble() method −using System; public class Demo { public static void Main(){ long d = 9846587687; Console.Write("Value (64-bit signed integer) = "+d); double res = BitConverter.Int64BitsToDouble(d); Console.Write("Value (double-precision floating point number) = "+res); } }OutputThis will produce the following output −Value (64-bit ... Read More

95 Views
The BitConverter.DoubleToInt64Bits() method in C# is used to convert the specified double-precision floating-point number to a 64-bit signed integer.SyntaxFollowing is the syntax −public static long DoubleToInt64Bits (double val);Above, Val is the number to convert.ExampleLet us now see an example to implement the BitConverter.DoubleToInt64Bits() method −using System; public class Demo { public static void Main(){ double d = 5.646587687; Console.Write("Value = "+d); long res = BitConverter.DoubleToInt64Bits(d); Console.Write("64-bit signed integer = "+res); } }OutputThis will produce the following output −Value = 5.646587687 64-bit signed integer = 4618043510978159912ExampleLet us ... Read More

200 Views
The Array.LastIndexOf() method in C# is used to search for the specified object and returns the index of the last occurrence within the entire Array.SyntaxFollowing is the syntax −public static int LastIndexOf (T[] array, T val);Above, the parameter arr is the one-dimensional, zero-based Array to search, whereas Val is the object to locate in an array.ExampleLet us now see an example to implement the Array.LastIndexOf() method −using System; public class Demo{ public static void Main(){ Console.WriteLine("Array elements..."); string[] arr = { "car", "bike", "truck", "bus"}; for (int i = 0; ... Read More

234 Views
The Array.GetEnumerator() method in C# is used to return an IEnumerator for the Array.SyntaxFollowing is the syntax −public virtual System.Collections.IEnumerator GetEnumerator ();ExampleLet us now see an example to implement the Array.GetEnumerator() method −using System; using System.Collections; public class Demo{ public static void Main(){ int j = 0; Console.WriteLine("Array elements..."); string[] arr = { "car", "bike", "truck", "bus"}; for (int i = 0; i < arr.Length; i++){ Console.Write("{0} ", arr[i]); } Console.WriteLine(); IEnumerator newEnum = ... Read More

507 Views
The Array.FindLast() method in C# is used to search for an element that matches the conditions defined by the specified predicate, and returns the last occurrence within the entire Array.SyntaxFollowing is the syntax −public static T FindLast (T[] array, Predicate match);Above, array is the one-dimensional, zero-based Array to search, whereas match is the Predicate that defines the conditions of the element to search for.ExampleLet us now see an example to implement the Array.FindLast() method −using System; public class Demo{ public static void Main(){ Console.WriteLine("Array elements..."); string[] arr = { "car", "bike", "truck", "bus"}; ... Read More

498 Views
The DateTime.ToFileTime() method in C# is used to convert the value of the current DateTime object to a Windows file time.SyntaxFollowing is the syntax −public long ToFileTime ();ExampleLet us now see an example to implement the DateTime.ToFileTime() method −using System; public class Demo { public static void Main() { DateTime d = DateTime.Now; Console.WriteLine("Date = {0}", d); long res = d.ToFileTime(); Console.WriteLine("Windows file time = {0}", res); } }OutputThis will produce the following output −Date = 10/16/2019 8:17:26 AM Windows file time = 132156874462559390ExampleLet us now ... Read More

701 Views
The DateTime.ToBinary() method in C# is used to serialize the current DateTime object to a 64-bit binary value that can be used to recreate the DateTime object. The return value is a 64-bit signed integer.SyntaxFollowing is the syntax −public long ToBinary ();ExampleLet us now see an example to implement the DateTime.ToBinary() method −using System; public class Demo { public static void Main() { DateTime d = new DateTime(2019, 10, 10, 8, 10, 40); Console.WriteLine("Date = {0}", d); long res = d.ToBinary(); Console.WriteLine("64-bit binary value : {0}", res); ... Read More