- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- 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 2628 Articles for Csharp
71 Views
The Decimal.GetHashCode() method in C# is used to return the hash code for the current instance.SyntaxFollowing is the syntax −public override int GetHashCode ();ExampleLet us now see an example to implement the Decimal.GetHashCode() method −using System; public class Demo { public static void Main(){ Decimal val = 135269.38193M; Console.WriteLine("Decimal Value = {0}", val); Console.WriteLine("HashCode = {0}", (val.GetHashCode()) ); } }OutputThis will produce the following output −Decimal Value = 135269.38193 HashCode = 1328665595ExampleLet us now see another example to implement the Decimal.GetHashCode() method −using System; public class Demo { ... Read More
322 Views
The Decimal.Ceiling() method in C# is used to return the smallest integral value greater than or equal to the specified decimal number.SyntaxFollowing is the syntax −public static decimal Ceiling (decimal val);Above, Val is the decimal number.ExampleLet us now see an example to implement the Decimal.Ceiling() method −using System; public class Demo { public static void Main(){ Decimal val1 = 12.85m; Decimal val2 = 3.45m; Console.WriteLine("Decimal 1 = "+val1); Console.WriteLine("Decimal 2 = "+val2); Console.WriteLine("Ceiling (val1) = "+Decimal.Ceiling(val1)); Console.WriteLine("Ceiling (val2) = "+Decimal.Ceiling(val2)); ... Read More
1K+ Views
The Decimal.Add() method in C# is used to add two specified Decimal values.SyntaxFollowing is the syntax −public static decimal Add (decimal val1, decimal val2);Above, va1 is the first decimal to add, whereas val2 is the second decimal to be added.ExampleLet us now see an example to implement the Decimal.Add() method −using System; public class Demo { public static void Main(){ Decimal val1 = 3.07m; Decimal val2 = 4.09m; Console.WriteLine("Decimal 1 = "+val1); Console.WriteLine("Decimal 2 = "+val2); Decimal res = Decimal.Add(val1, val2); ... Read More
424 Views
The DateTimeOffset.ToUnixTimeSeconds() method in C# is used to return the number of seconds that have elapsed since 1970-01-01T00:00:00Z.SyntaxFollowing is the syntax −public long ToUnixTimeSeconds ();ExampleLet us now see an example to implement the DateTimeOffset.ToUnixTimeSeconds() method −using System; public class Demo { public static void Main() { DateTimeOffset dateTimeOffset = new DateTimeOffset(1967, 11, 11, 6, 15, 45, new TimeSpan(3, 0, 0)); Console.WriteLine("DateTimeOffset = {0}", dateTimeOffset); Console.WriteLine("Number of seconds: "+dateTimeOffset.ToUnixTimeSeconds()); DateTimeOffset res = dateTimeOffset.ToOffset(new TimeSpan(-5, 0, 0)); Console.WriteLine("DateTimeOffset (updated) = {0}", res); Console.WriteLine("Number ... Read More
573 Views
The DateTimeOffset.ToUnixTimeMilliseconds() method in C# is used to return the number of milliseconds that have elapsed since 1970-01-01T00:00:00.000Z.SyntaxFollowing is the syntax −public long ToUnixTimeMilliseconds ();ExampleLet us now see an example to implement the DateTimeOffset.ToUnixTimeMilliseconds() method −using System; public class Demo { public static void Main() { DateTimeOffset dateTimeOffset = new DateTimeOffset(2019, 9, 10, 4, 20, 10, new TimeSpan(5, 0, 0)); Console.WriteLine("DateTimeOffset = {0}", dateTimeOffset); Console.WriteLine("Number of milliseconds: "+dateTimeOffset.ToUnixTimeMilliseconds()); DateTimeOffset res = dateTimeOffset.ToOffset(new TimeSpan(-5, 0, 0)); Console.WriteLine("DateTimeOffset (updated) = {0}", res); Console.WriteLine("Number ... Read More
497 Views
The DateTimeOffset.ToOffset() method in C# is used to convert the value of the current DateTimeOffset object to the date and time specified by an offset value.SyntaxFollowing is the syntax −public DateTimeOffset ToOffset (TimeSpan val);Above, the value is the offset to convert the DateTimeOffset value to.ExampleLet us now see an example to implement the DateTimeOffset.ToOffset() method −using System; public class Demo { public static void Main() { DateTimeOffset dateTimeOffset = new DateTimeOffset(2019, 9, 10, 4, 20, 30, new TimeSpan(-5, 0, 0)); Console.WriteLine("DateTimeOffset = {0}", dateTimeOffset); DateTimeOffset res = dateTimeOffset.ToOffset(new TimeSpan(-10, 1, ... Read More
51 Views
The DateTimeOffset.ToLocalTime() method in C# is used to convert the current DateTimeOffset object to a DateTimeOffset object that represents the local time.SyntaxFollowing is the syntax −public DateTimeOffset ToLocalTime ();ExampleLet us now see an example to implement the DateTimeOffset.ToLocalTime() method −using System; public class Demo { public static void Main() { DateTimeOffset local; DateTimeOffset dateTimeOffset = DateTimeOffset.Now; Console.WriteLine("DateTimeOffset = {0}", dateTimeOffset); local = dateTimeOffset.ToLocalTime(); Console.WriteLine("Local Time = "+local.ToString()); } }OutputThis will produce the following output −DateTimeOffset = 10/16/2019 11:20:35 AM +00:00 Local Time = ... Read More
32 Views
The DateTimeOffset.ToFileTime() method in C# is used to convert the value of the current DateTimeOffset object to a Windows file time. The method returns an Int64 value of the current DateTimeOffset object, expressed as a Windows file time.SyntaxFollowing is the syntax −public long ToFileTime ();ExampleLet us now see an example to implement the DateTimeOffset.ToFileTime() method −using System; public class Demo { public static void Main() { DateTimeOffset dateTimeOffset1 = new DateTimeOffset(2019, 11, 10, 6, 20, 10, new TimeSpan(-5, 0, 0)); Console.WriteLine("DateTimeOffset = {0}", dateTimeOffset1); int hash = dateTimeOffset1.GetHashCode(); ... Read More
47 Views
The DateTimeOffset.GetHashCode method in C# is used to return the hash code for the current DateTimeOffset object. This method returns a 32-bit signed integer hash code.SyntaxFollowing is the syntax −public override int GetHashCode ();ExampleLet us now see an example to implement the DateTimeOffset.GetHashCode() method −using System; public class Demo { public static void Main() { DateTimeOffset dateTimeOffset1 = new DateTimeOffset(2019, 09, 10, 6, 20, 10, new TimeSpan(-5, 0, 0)); DateTimeOffset dateTimeOffset2 = new DateTimeOffset(2019, 11, 12, 8, 20, 10, new TimeSpan(-5, 0, 0)); Console.WriteLine("DateTimeOffset1 = {0}", dateTimeOffset1); ... Read More
62 Views
The Tuple class represents a 7-tuple, which is called septet. A tuple is a data structure that has a sequence of elements.It is used in −Easier access to a data set.Easier manipulation of a data set.To represent a single set of data.To return multiple values from a methodTo pass multiple values to a methodExampleLet us now see an example to implement the 7-tuple in C# −using System; public class Demo { public static void Main(string[] args) { Tuple tuple = new Tuple(100, 150, 200, 300, 600, 1000, 2000); Console.WriteLine("Value (Item1)= " + tuple.Item1); ... Read More