Articles on Trending Technologies

Technical articles with clear explanations and examples

What are Base and Derived Classes in C#?

Chandu yadav
Chandu yadav
Updated on 17-Mar-2026 366 Views

In C# object-oriented programming, inheritance allows you to create new classes based on existing ones. A base class (also called parent class) is the original class that provides common properties and methods. A derived class (also called child class) inherits from the base class and can access its members while adding its own specific functionality. The derived class automatically inherits all accessible members from the base class, including fields, properties, and methods, promoting code reusability and establishing an "is-a" relationship. Syntax Following is the syntax for creating a derived class in C# − class BaseClass ...

Read More

Math.Log10() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 453 Views

The Math.Log10() method in C# calculates the base-10 logarithm of a specified number. This method is particularly useful in mathematical calculations, scientific computations, and when working with exponential data that needs to be converted to a logarithmic scale. Syntax Following is the syntax for the Math.Log10() method − public static double Log10(double d); Parameters d − A double-precision floating-point number whose base-10 logarithm is to be found. Return Value The Log10() method returns different values based on the input parameter − Input Parameter (d) Return Value ...

Read More

How to define a single-dimensional array in C Sharp?

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

An array is used to store a collection of data, but it is often more useful to think of an array as a collection of variables of the same type stored at contiguous memory locations. A single-dimensional array in C# is a linear collection of elements of the same data type. It allows you to store multiple values in a single variable and access them using an index. Syntax Following is the syntax for declaring a single-dimensional array − datatype[] arrayName = new datatype[size]; Following is the syntax for initializing an array with ...

Read More

Networking in C#

George John
George John
Updated on 17-Mar-2026 3K+ Views

The .NET Framework provides a layered, extensible, and managed implementation of networking services that you can easily integrate into your applications. The System.Net namespace contains classes for network communication, web requests, DNS operations, and secure connections. Syntax To use networking classes, include the System.Net namespace − using System.Net; Creating a URI and web request − Uri uri = new Uri("http://www.example.com/"); WebRequest request = WebRequest.Create(uri); Using Uri Class The Uri class in C# provides object representation of a uniform resource identifier (URI). It helps parse and manipulate web addresses − ...

Read More

C# Program to display the number of days in a month

Arjun Thakur
Arjun Thakur
Updated on 17-Mar-2026 808 Views

The DateTime.DaysInMonth() method in C# is used to display the number of days in a specific month and year. This static method is particularly useful when working with calendar calculations or when you need to validate dates. Syntax Following is the syntax for using DateTime.DaysInMonth() − int days = DateTime.DaysInMonth(year, month); Parameters year: An integer representing the year (1 to 9999). month: An integer representing the month (1 to 12). Return Value Returns an integer representing the number of days in the specified month and ...

Read More

C# Program to find a key in a Hashtable

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

A Hashtable in C# is a collection of key-value pairs where each key is unique. To check if a specific key exists in a Hashtable, you can use the Contains() method or ContainsKey() method. Syntax Following is the syntax for creating a Hashtable and checking if a key exists − Hashtable hashtable = new Hashtable(); hashtable.Add(key, value); bool exists = hashtable.Contains(key); Alternatively, you can use ContainsKey() method − bool exists = hashtable.ContainsKey(key); Using Contains() Method The Contains() method returns true if the specified key exists in the Hashtable, otherwise ...

Read More

Byte.MinValue Field in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 168 Views

The Byte.MinValue field in C# represents the smallest possible value that a byte data type can hold. Since byte is an unsigned 8-bit integer, its minimum value is always 0. Syntax Following is the syntax for accessing the Byte.MinValue field − public const byte MinValue = 0; The field is accessed as − byte minValue = Byte.MinValue; Understanding Byte Range The byte data type in C# is an unsigned 8-bit integer that can store values from 0 to 255. The Byte.MinValue constant provides the lower bound of this range. ...

Read More

Abstract vs Sealed Classes vs Class Members in C#

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

The abstract class includes abstract and non-abstract methods. You cannot instantiate an abstract class directly. The sealed class prevents inheritance and you cannot use it as a base class. Both abstract and sealed classes can contain various types of class members with different access modifiers and behaviors. Abstract Classes To declare an abstract class, you need to place the keyword abstract before the class definition. An abstract class can contain abstract methods that must be implemented by derived classes − Syntax public abstract class ClassName { public abstract void MethodName(); ...

Read More

What are file operations in C#?

Ankith Reddy
Ankith Reddy
Updated on 17-Mar-2026 507 Views

File operations in C# allow you to work with files and directories on the file system. These operations include creating, opening, reading, writing, appending, and deleting files. The System.IO namespace provides comprehensive classes and methods for file handling. The FileStream class is the primary class for file operations in C#. It provides low-level access to files and derives from the abstract Stream class. This class enables reading from, writing to, and closing files efficiently. Syntax To create a FileStream object, use the following syntax − FileStream fileStream = new FileStream(fileName, FileMode, FileAccess, FileShare); ...

Read More

TimeSpan.From methods in C# ()

Chandu yadav
Chandu yadav
Updated on 17-Mar-2026 225 Views

The TimeSpan.From methods in C# provide a convenient way to create TimeSpan objects from specific time units. These static methods include FromDays, FromHours, FromMinutes, FromSeconds, FromMilliseconds, and FromTicks. Each method takes a numeric value and returns a TimeSpan representing that duration in the specified unit. This approach is more readable than manually calculating ticks or using TimeSpan constructors. Syntax Following are the syntax formats for the most commonly used TimeSpan.From methods − TimeSpan.FromDays(double value) TimeSpan.FromHours(double value) TimeSpan.FromMinutes(double value) TimeSpan.FromSeconds(double value) TimeSpan.FromMilliseconds(double value) TimeSpan.FromTicks(long value) Parameters All TimeSpan.From methods (except FromTicks) accept a ...

Read More
Showing 10781–10790 of 61,297 articles
Advertisements