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 225 of 840
Type.GetNestedType() Method in C#
The Type.GetNestedType() method in C# is used to retrieve a specific nested type that is declared within the current type. This method is part of the System.Reflection namespace and provides access to nested classes, interfaces, structs, or other types defined inside a parent type. Syntax Following are the overloads for the GetNestedType() method − public Type GetNestedType(string name); public abstract Type GetNestedType(string name, System.Reflection.BindingFlags bindingAttr); Parameters name − The string containing the simple name of the nested type to get. bindingAttr − A combination of enumeration values that specify how the search ...
Read MoreType.GetNestedTypes() Method in C#
The Type.GetNestedTypes() method in C# is used to get the types nested within the current Type. This method is particularly useful when working with reflection to discover and work with nested classes, interfaces, or other types defined within a class. Syntax Following is the syntax for the GetNestedTypes() method − public Type[] GetNestedTypes(); public abstract Type[] GetNestedTypes(System.Reflection.BindingFlags bindingAttr); Parameters The overloaded version accepts a BindingFlags parameter that specifies which nested types to return − bindingAttr − A combination of BindingFlags values that control which nested types are returned (e.g., Public, NonPublic, ...
Read MoreDateTimeOffset.Add() Method in C#
The DateTimeOffset.Add() method in C# returns a new DateTimeOffset object that represents the original date and time with a specified time interval added to it. This method is useful for performing date and time arithmetic while preserving the original offset information. Syntax Following is the syntax − public DateTimeOffset Add(TimeSpan timespan); Parameters timespan − A TimeSpan object that represents the time interval to add. This can be positive (to add time) or negative (to subtract time). Return Value Returns a new DateTimeOffset object whose value is the sum of ...
Read MoreCharEnumerator.ToString() Method in C#
The CharEnumerator.ToString() method in C# returns a string representation of the current CharEnumerator object. This method is inherited from the Object class and provides basic type information about the enumerator instance. Syntax Following is the syntax − public override string ToString(); Return Value The method returns a string that represents the current object. For CharEnumerator, this typically returns the fully qualified type name "System.CharEnumerator". Using CharEnumerator.ToString() Method Example Let us see an example to implement the CharEnumerator.ToString() method − using System; public class Demo { ...
Read MoreDateTimeOffset.AddDays() Method in C#
The DateTimeOffset.AddDays() method in C# returns a new DateTimeOffset object that adds a specified number of whole and fractional days to the value of the current instance. This method allows you to add or subtract days while preserving the original timezone offset information. Syntax Following is the syntax − public DateTimeOffset AddDays(double days); Parameters days − A number of whole and fractional days. The value parameter can be negative or positive. Return Value Returns a new DateTimeOffset object whose value is the sum of the date and time represented ...
Read MoreDateTimeOffset.AddHours() Method in C#
The DateTimeOffset.AddHours() method in C# is used to add a specified number of whole and fractional hours to the value of a DateTimeOffset instance. This method returns a new DateTimeOffset object that represents the original date and time plus the specified hours, while preserving the original offset from UTC. Syntax Following is the syntax − public DateTimeOffset AddHours(double hours); Parameters hours − A double value representing the number of hours to add. This can be a whole number or fractional value. To subtract hours, provide a negative value. Return Value Returns ...
Read MoreDateTimeOffset.AddMilliseconds() Method in C#
The DateTimeOffset.AddMilliseconds() method in C# returns a new DateTimeOffset object that adds a specified number of milliseconds to the value of the current instance. This method is useful for precise time calculations where millisecond accuracy is required. The method accepts a double parameter representing the number of milliseconds to add. To subtract milliseconds, pass a negative value. The original DateTimeOffset instance remains unchanged as this method returns a new instance. Syntax Following is the syntax − public DateTimeOffset AddMilliseconds(double value); Parameters value − A double representing the number of milliseconds to ...
Read MoreConvert.FromBase64String(String) Method in C#
The Convert.FromBase64String(String) method in C# converts the specified string, which encodes binary data as base-64 digits, to an equivalent 8-bit unsigned integer array. This method is commonly used for decoding base64-encoded data back to its original byte representation. Syntax Following is the syntax − public static byte[] FromBase64String (string str); Parameters str − The string to convert. It must be a valid base64-encoded string. Return Value Returns a byte[] array containing the decoded binary data from the base64 string. Using FromBase64String for Byte Array Conversion The most common use ...
Read MoreBoolean.Equals(Boolean) Method in C#
The Boolean.Equals(Boolean) method in C# returns a value indicating whether this instance is equal to a specified Boolean object. This method compares the current Boolean instance with another Boolean value and returns true if they are equal, otherwise false. Syntax Following is the syntax − public bool Equals(bool obj); Parameters obj − A Boolean value to compare to this instance. Return Value This method returns true if obj has the same value as this instance; otherwise, false. Example Let us see an example to implement the Boolean.Equals(Boolean) ...
Read MoreBoolean.Equals(Object) Method in C#
The Boolean.Equals(Object) method in C# returns a value indicating whether the current Boolean instance is equal to a specified object. This method compares the Boolean value with another object, returning true only if the object is also a Boolean with the same value. Syntax Following is the syntax − public override bool Equals (object obj); Parameters obj − An object to compare with this Boolean instance. Return Value Returns true if the object is a Boolean instance with the same value; otherwise, false. Using Boolean.Equals() with Different Data Types ...
Read More