karthikeya Boyini

karthikeya Boyini

1,421 Articles Published

Articles by karthikeya Boyini

Page 4 of 143

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

karthikeya Boyini
karthikeya Boyini
Updated on 17-Mar-2026 137 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 350 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

C# Percent ("P") Format Specifier

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

The percent ("P") format specifier in C# is used to format numbers as percentages. It multiplies the number by 100 and appends a percentage sign (%) to create a string representation of the percentage value. Syntax Following is the syntax for using the percent format specifier − number.ToString("P") // Default precision (2 decimal places) number.ToString("Pn") // Specify n decimal places Where n represents the number of decimal places to display after the decimal point. How It Works The percent ...

Read More

Const vs Static vs Readonly in C#

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

The const, static, and readonly keywords in C# serve different purposes for declaring fields and members. Understanding their differences is crucial for choosing the right approach based on your specific needs. Const Constant fields are compile-time constants that cannot be modified after declaration. They must be assigned a value at the time of declaration and are implicitly static. const int a = 5; Example using System; class Constants { public const int MaxValue = 100; public const string AppName = "MyApp"; public ...

Read More

C# Program to get the difference between two dates in seconds

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

In C#, you can calculate the difference between two dates in seconds using the TimeSpan structure. When you subtract one DateTime from another, it returns a TimeSpan object that represents the time interval between them. Syntax Following is the syntax for calculating date difference in seconds − DateTime date1 = new DateTime(year, month, day, hour, minute, second); DateTime date2 = new DateTime(year, month, day, hour, minute, second); TimeSpan difference = date2 - date1; double seconds = difference.TotalSeconds; Using DateTime Subtraction The most straightforward approach is to subtract one DateTime from another, which returns ...

Read More

C# Program to replace a special character from a String

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

The Replace() method in C# is used to replace all occurrences of a specified character or substring in a string with a new character or substring. This method is particularly useful for removing or replacing special characters from strings. Syntax Following is the syntax for replacing characters using the Replace() method − string.Replace(oldChar, newChar) string.Replace(oldString, newString) Parameters oldChar/oldString − The character or string to be replaced. newChar/newString − The character or string to replace with. Return Value The Replace()

Read More

How to clear screen using C#?

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

The Console.Clear() method in C# is used to clear the console screen and its buffer. When this method is called, the cursor automatically moves to the top-left corner of the console window, effectively giving you a clean slate to work with. Syntax Following is the syntax for the Console.Clear() method − Console.Clear(); How It Works The Console.Clear() method performs the following actions − Clears all text and content from the console window Resets the cursor position to (0, 0) — the top-left corner Preserves the current ...

Read More

How to copy a List collection to an array?

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

To copy a C# List collection to an array, you can use several methods. The most common approaches are the CopyTo() method, the ToArray() method, or creating an array with the List constructor. Syntax Following is the syntax for using CopyTo() method − list.CopyTo(array); list.CopyTo(array, arrayIndex); Following is the syntax for using ToArray() method − T[] array = list.ToArray(); Using CopyTo() Method The CopyTo() method copies all elements from the List to an existing array starting at the specified array index − using System; using System.Collections.Generic; ...

Read More
Showing 31–40 of 1,421 articles
« Prev 1 2 3 4 5 6 143 Next »
Advertisements