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
Articles by AmitDiwan
Page 223 of 840
DateTime.ToShortDateString() Method in C#
The DateTime.ToShortDateString() method in C# is used to convert the value of the current DateTime object to its equivalent short date string representation. This method formats the date according to the current culture's short date pattern, excluding the time portion. Syntax Following is the syntax − public string ToShortDateString(); Return Value This method returns a string that represents the short date value of the current DateTime object. The format depends on the current culture's DateTimeFormatInfo.ShortDatePattern property. Using ToShortDateString() with Specific DateTime Example using System; public class Demo { ...
Read MoreInt16.Equals Method in C# with Examples
The Int16.Equals() method in C# is used to return a value indicating whether this instance is equal to a specified object or Int16. This method provides two overloads − one for comparing with another Int16 value and another for comparing with any object. Syntax Following is the syntax for both overloads − public bool Equals(short ob); public override bool Equals(object ob); Parameters For the first overload − ob − An Int16 value to compare to this instance. For the second overload − ob − The object to ...
Read MoreMath.Round() Method in C#
The Math.Round() method in C# rounds a value to the nearest integer or to the specified number of fractional digits. This method provides several overloads to handle different data types and rounding scenarios. Syntax The following are the primary syntax forms of Math.Round() − Math.Round(Double) Math.Round(Double, Int32) Math.Round(Double, Int32, MidpointRounding) Math.Round(Double, MidpointRounding) Math.Round(Decimal) Math.Round(Decimal, Int32) Math.Round(Decimal, Int32, MidpointRounding) Math.Round(Decimal, MidpointRounding) Parameters value − The decimal or double number to be rounded. digits − The number of fractional digits in the return value. mode − Specification for how to round value if it ...
Read MoreCharEnumerator.MoveNext() Method in C#
The CharEnumerator.MoveNext() method in C# advances the internal index of the current CharEnumerator object to the next character of the enumerated string. It returns true if the enumerator successfully moved to the next character, or false if it has passed the end of the string. Syntax public bool MoveNext(); Return Value The method returns a bool value − true − if the enumerator was successfully advanced to the next character false − if the enumerator has passed the end of the string ...
Read MoreMath.Sign() Method in C#
The Math.Sign() method in C# is used to return an integer that indicates the sign of a number. It returns +1 for positive numbers, -1 for negative numbers, and 0 for zero. Syntax The Math.Sign() method has multiple overloads to handle different numeric types − public static int Sign(sbyte value); public static int Sign(short value); public static int Sign(int value); public static int Sign(long value); public static int Sign(float value); public static int Sign(double value); public static int Sign(decimal value); Return Value The method returns an int value − -1 if ...
Read MoreMath.Sin() Method in C#
The Math.Sin() method in C# is used to return the sine of a specified angle. The method accepts an angle in radians and returns a double value representing the sine of that angle. Syntax Following is the syntax for the Math.Sin() method − public static double Sin(double val); Parameters val − A double value representing an angle in radians. Return Value The method returns a double value representing the sine of the specified angle. The return value ranges from -1 to 1. For special cases − ...
Read MoreCharEnumerator.Reset() Method in C#
The CharEnumerator.Reset() method in C# initializes the enumerator's position to logically before the first character of the enumerated string. This method is useful when you need to restart enumeration from the beginning after having already iterated through the string. Syntax Following is the syntax for the CharEnumerator.Reset() method − public void Reset(); Parameters This method takes no parameters. Return Value This method does not return any value (void). How It Works When you call Reset(), the enumerator's internal position is moved to before the first character. After calling Reset(), ...
Read MoreMath.Sinh() Method in C#
The Math.Sinh() method in C# calculates the hyperbolic sine of a specified angle in radians. The hyperbolic sine function is defined mathematically as (ex - e-x)/2, where e is Euler's number (approximately 2.71828). This method is commonly used in mathematical calculations involving hyperbolic functions, engineering applications, and scientific computations. Syntax Following is the syntax of the Math.Sinh() method − public static double Sinh(double value) Parameters value: A double-precision floating-point number representing an angle in radians for which the hyperbolic sine is to be calculated. Return Value Returns a double representing ...
Read MoreDateTime.AddMilliseconds() Method in C#
The DateTime.AddMilliseconds() method in C# is used to add a specified number of milliseconds to a DateTime instance. This method returns a new DateTime object with the updated value, leaving the original DateTime unchanged. Syntax Following is the syntax − public DateTime AddMilliseconds(double value); Parameters value − A double representing the number of milliseconds to add. Can be positive or negative. Return Value Returns a new DateTime object whose value is the sum of the date and time represented by this instance and the number of milliseconds ...
Read MoreDateTime.AddMinutes() Method in C#
The DateTime.AddMinutes() method in C# is used to add the specified number of minutes to the value of a DateTime instance. It returns a new DateTime object representing the calculated time without modifying the original instance. Syntax Following is the syntax − public DateTime AddMinutes(double minutes); Parameters minutes − A double value representing the number of minutes to add. The value can be positive (to add minutes) or negative (to subtract minutes). Fractional values are allowed. Return Value Returns a new DateTime object whose value is the sum of the date ...
Read More