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 186 of 196
DateTime.ToOADate() Method in C#
The DateTime.ToOADate() method in C# is used to convert a DateTime instance to its equivalent OLE Automation date. OLE Automation dates are represented as double-precision floating-point numbers where the integer part represents the number of days since December 30, 1899, and the fractional part represents the time of day. Syntax Following is the syntax − public double ToOADate(); Return Value Returns a double representing the OLE Automation date equivalent of the current DateTime instance. How It Works OLE Automation dates use a specific format where: Integer part: Number ...
Read MoreDateTime.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 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 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 MoreType.GetMember() Method in C#
The Type.GetMember() method in C# is used to retrieve information about specified members of the current Type using reflection. It returns an array of MemberInfo objects that represent the members matching the specified name and binding criteria. Syntax Following are the syntax variations for the Type.GetMember() method − public System.Reflection.MemberInfo[] GetMember(string name); public virtual System.Reflection.MemberInfo[] GetMember(string name, System.Reflection.BindingFlags bindingAttr); Parameters name − A string specifying the name of the member to search for. bindingAttr − A combination of BindingFlags values that control how the search is conducted. ...
Read More