karthikeya Boyini

karthikeya Boyini

1,420 Articles Published

Articles by karthikeya Boyini

Page 8 of 142

C# Nullable Datetime

karthikeya Boyini
karthikeya Boyini
Updated on 17-Mar-2026 18K+ Views

The nullable DateTime in C# allows you to assign null values to DateTime variables, which is useful when a date might not be available or applicable. This is particularly valuable in database operations where date fields can be NULL, or when dealing with optional date parameters. Syntax A nullable DateTime is declared using the question mark (?) syntax − DateTime? variableName = null; Alternatively, you can use the full Nullable syntax − Nullable variableName = null; Key Properties and Methods Nullable DateTime provides several useful properties and methods − ...

Read More

C# Program to read all the lines of a file at once

karthikeya Boyini
karthikeya Boyini
Updated on 17-Mar-2026 261 Views

The File.ReadAllText() method in C# reads all the text from a file and returns it as a single string. This method is part of the System.IO namespace and provides a simple way to read entire file contents at once. When you need to read all lines from a text file in one operation, ReadAllText() is more efficient than reading line by line, especially for smaller files. Syntax Following is the syntax for the File.ReadAllText() method − public static string ReadAllText(string path); Parameters path − The file path to read from. Can ...

Read More

Character constants vs String literals in C#

karthikeya Boyini
karthikeya Boyini
Updated on 17-Mar-2026 545 Views

In C#, both character constants and string literals are used to represent text data, but they serve different purposes and have distinct syntax rules. Character constants represent single characters, while string literals represent sequences of characters (text). Character Constants Character constants are enclosed in single quotes and represent a single character. They are stored in variables of type char. Syntax char variableName = 'character'; Character constants can be − Plain characters − 'x', 'A', '5' Escape sequences − '', '\t', '' Unicode characters − '\u0041' (represents 'A') Example ...

Read More

What is method overloading in C#?

karthikeya Boyini
karthikeya Boyini
Updated on 17-Mar-2026 2K+ Views

Method overloading in C# allows you to define multiple methods with the same name but different parameters. This enables you to create methods that perform similar operations but accept different types or numbers of arguments. Method overloading can be achieved by changing the number of parameters, the data types of parameters, or the order of parameters. The compiler determines which method to call based on the arguments passed at runtime. Syntax Following is the syntax for method overloading − public returnType MethodName(type1 param1) { } public returnType MethodName(type1 param1, type2 param2) { } public returnType ...

Read More

Long Time ("T") Format Specifier in C#

karthikeya Boyini
karthikeya Boyini
Updated on 17-Mar-2026 512 Views

The Long Time ("T") format specifier in C# is a standard date and time format specifier that displays the time portion of a DateTime value in a long format. This format is culture-sensitive and displays the full time representation including hours, minutes, seconds, and AM/PM designator where applicable. The "T" format specifier is defined by the DateTimeFormatInfo.LongTimePattern property and typically follows the pattern HH:mm:ss for 24-hour format or includes AM/PM for 12-hour format, depending on the culture. Syntax Following is the syntax for using the Long Time format specifier − dateTime.ToString("T") dateTime.ToString("T", CultureInfo.CreateSpecificCulture("culture-name")) ...

Read More

An array of streams in C#

karthikeya Boyini
karthikeya Boyini
Updated on 17-Mar-2026 849 Views

An array of streams in C# refers to using arrays or collections along with stream objects like StreamWriter and StreamReader to perform file I/O operations. This approach is commonly used when you need to write multiple data items from an array to a file or read file content into an array structure. Syntax Following is the syntax for writing array data to a file using StreamWriter − using (StreamWriter writer = new StreamWriter("filename.txt")) { foreach (dataType item in arrayName) { writer.WriteLine(item); ...

Read More

What is the IsFixedSize property of Hashtable class in C#?

karthikeya Boyini
karthikeya Boyini
Updated on 17-Mar-2026 158 Views

The IsFixedSize property of the Hashtable class in C# returns a bool value indicating whether the Hashtable has a fixed size. When this property returns false, you can add or remove elements. When it returns true, the size is fixed and you cannot add or remove elements. For a regular Hashtable created using the default constructor, IsFixedSize always returns false, meaning it can grow dynamically as you add elements. Syntax Following is the syntax to check if a Hashtable has a fixed size − bool isFixed = hashtable.IsFixedSize; Return Value The IsFixedSize ...

Read More

How to compile and execute C# programs on Mac OS?

karthikeya Boyini
karthikeya Boyini
Updated on 17-Mar-2026 2K+ Views

To compile and execute C# programs on Mac OS, you need an Integrated Development Environment (IDE) or compiler toolchain. Mac OS offers several excellent options for C# development, ranging from full-featured IDEs to lightweight editors and command-line tools. The most popular and recommended approach is using Visual Studio for Mac or the newer Visual Studio Code with the C# extension. Additionally, you can use the .NET CLI for command-line compilation and execution. Using Visual Studio for Mac Visual Studio for Mac is a native macOS IDE specifically designed for .NET development. It provides IntelliSense, debugging tools, and ...

Read More

What is C# Programming?

karthikeya Boyini
karthikeya Boyini
Updated on 17-Mar-2026 360 Views

C# is a modern, general-purpose, object-oriented programming language developed by Microsoft in 2000. It was created by Anders Hejlsberg and his team as part of Microsoft's .NET initiative to provide a robust, type-safe language that combines the power of C++ with the simplicity of Visual Basic. C# is designed for the Common Language Infrastructure (CLI), which consists of executable code and a runtime environment that allows various high-level languages to run on different computer platforms and architectures. The language compiles to bytecode called Common Intermediate Language (CIL), which runs on the .NET runtime. Key Features of C# ...

Read More

C# Exponential ("E") Format Specifier

karthikeya Boyini
karthikeya Boyini
Updated on 17-Mar-2026 1K+ Views

The Exponential ("E") format specifier in C# converts a number to scientific notation. It represents numbers in the form of a coefficient multiplied by a power of 10, making it ideal for very large or very small numbers. Syntax The exponential format specifier has the following syntax − "E" or "e" "En" or "en" (where n specifies decimal places) The resulting string format is − "-d.ddd...E+ddd" or "-d.ddd...e+ddd" Where "d" represents a digit (0-9). The "E" or "e" separates the coefficient from the exponent. Exponential ...

Read More
Showing 71–80 of 1,420 articles
« Prev 1 6 7 8 9 10 142 Next »
Advertisements