- 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
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
5K+ Views
The Math.Max() method in C# is used to return the larger of two specified numbers. This method works for both the numbers being Double, Decimal, Int16, Int32, etc.SyntaxFollowing is the syntax −public static ulong Max (ulong val1, ulong val2); public static uint Max (uint val1, uint val2); public static ushort Max (ushort val1, ushort val2); public static float Max (float val1, float val2); public static byte Max (byte val1, byte val2); public static long Max (long val1, long val2);ExampleLet us now see an example to implement Math.Max() method −using System; public class Demo { public static void Main(){ ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
180 Views
The Tuple class represents a 4-tuple, which is called quadruple. 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 4-tuple in C# −using System; public class Demo { public static void Main(string[] args) { Tuple tuple = new Tuple("nathan", "steve", "katie", "tim"); Console.WriteLine("Value (Item1)= " + tuple.Item1); ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
289 Views
The Tuple class represents a 3-tuple, which is called triple. 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 3-tuple in C# −using System; public class Demo { public static void Main(string[] args) { Tuple tuple = new Tuple(35, "steve", "katie"); Console.WriteLine("Value (Item1)= " + tuple.Item1); Console.WriteLine("Value ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
2K+ Views
The DateTimeOffset.Compare() method in C# is used to compare two DateTimeOffset objects and indicates whether the first is earlier than the second, equal to the second, or later than the second. It returns an integer value, 0 − If val1 is later than val2SyntaxFollowing is the syntax −public static int Compare (DateTimeOffset val1, DateTimeOffset val1);Above, val1 is the 1st object to compare, whereas val2 is the 2nd.ExampleLet us now see an example to implement the DateTimeOffset.Compare() method −using System; public class Demo { public static void Main() { DateTimeOffset dateTimeOffset1 = new DateTimeOffset(2019, 09, 09, 8, ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
37 Views
The DateTimeOffset.AddYears() method in C# is used to add a specified number of years to the value of this instance.SyntaxFollowing is the syntax −public DateTimeOffset AddYears (int val);Above, the Val parameter is the years to be added to the offset. To subtract, you need to set negative values.ExampleLet us now see an example to implement the DateTimeOffset.AddYears() method −using System; public class Demo { public static void Main() { DateTimeOffset dateTimeOffset = new DateTimeOffset(2019, 06, 09, 8, 20, 10, new TimeSpan(-5, 0, 0)); Console.WriteLine("DateTimeOffset (before adding years) = {0}", dateTimeOffset); ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
746 Views
The Math.Atan() method in C# is used to return the angle whose tan is the specified number. The number is a double value argument. The method returns an angle, θ, measured in radians, such that -Π/2 ≤θ≤Π/2.SyntaxFollowing is the syntax −public static double Atan(double num)ExampleLet us now see an example to implement the Math.Atan() method −using System; public class Demo { public static void Main(){ double val1 = 0.0; double val2 = 1.0; Console.WriteLine("Return value of {0} : {1}", val1, Math.Atan(val1)); Console.WriteLine("Return value of {0} : {1}", ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
111 Views
The Math.Asin() method in C# is used to return the angle whose sine is the specified number. The number is a double value argument.SyntaxFollowing is the syntax −public static double Asin (double val);Above, Val is a number representing a sine. The value of Val must be greater than or equal to -1, but less than or equal to 1.ExampleLet us now see an example to implement Math.Asin() method −using System; public class Demo { public static void Main(){ double val1 = -0.0; double val2 = Double.PositiveInfinity; double val3 = Double.NaN; ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
282 Views
The Math.Acos() method in C# returns the angle whose cosine is the specified number. This number is a double value argument. SyntaxThe syntax is as follows −public static double Acos (double val);Above, Val is the number representing a cosine, where Val must be greater than or equal to -1, but less than or equal to 1.ExampleLet us now see an example to implement Math.Acos() method −using System; public class Demo { public static void Main(){ double val1 = -0.0; double val2 = Double.PositiveInfinity; double val3 = Double.NaN; Console.WriteLine("Return ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
15K+ Views
The Math.Abs() method in C# is used to return the absolute value of a specified number in C#. This specified number can be decimal, double, 16-bit signed integer, etc.ExampleLet us now see an example to implement the Math.abs() method to return the absolute value of double number −using System; class Demo { public static void Main(){ Double val1 = 30.40; Double val2 = Double.MinValue; Double val3 = Double.MaxValue; Console.WriteLine("Absolute value of {0} : {1}", val1, Math.Abs(val1)); Console.WriteLine("Absolute value of {0} : {1}", val2, Math.Abs(val2)); ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
208 Views
The Dictionary.Values property in C# is used to fetch all the values in the Dictionary.SyntaxFollowing is the syntax −public System.Collections.Generic.Dictionary.KeyCollection Values{ get; }ExampleLet us now see an example to implement the Dictionary.Values property −using System; using System.Collections.Generic; public class Demo { public static void Main(){ Dictionary dict = new Dictionary(); dict.Add("One", "Kagido"); dict.Add("Two", "Ngidi"); dict.Add("Three", "Devillers"); dict.Add("Four", "Smith"); dict.Add("Five", "Warner"); Console.WriteLine("Count of elements = "+dict.Count); Console.WriteLine("Key/value pairs..."); foreach(KeyValuePair res in dict){ ... Read More