Nizamuddin Siddiqui

Nizamuddin Siddiqui

1,958 Articles Published

Articles by Nizamuddin Siddiqui

Page 12 of 196

What is Liskov Substitution principle and how to implement in C#?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 17-Mar-2026 410 Views

The Liskov Substitution Principle (LSP) is one of the five SOLID principles in object-oriented programming. It states that derived types must be completely substitutable for their base types without altering the correctness of the program. In other words, objects of a superclass should be replaceable with objects of its subclasses without breaking the application. Definition According to LSP, we should be able to treat a child class as though it were the parent class. This means that all derived classes should retain the functionality of their parent class and cannot replace any functionality the parent provides in a ...

Read More

How to explicitly call base class constructor from child class in C#?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 17-Mar-2026 1K+ Views

The base keyword in C# is used to explicitly call a constructor from the parent class when creating an instance of a derived class. This is essential when the base class doesn't have a parameterless constructor or when you need to pass specific values to initialize the base class properly. By default, C# automatically calls the parameterless constructor of the base class. However, when the base class only has parameterized constructors, you must explicitly specify which constructor to call using the base keyword. Syntax Following is the syntax for calling a base class constructor from a derived ...

Read More

How to get the name of the current executable in C#?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 17-Mar-2026 5K+ Views

There are several ways to get the name of the current executable in C#. Each method provides different levels of detail about the executable file, from just the name to the full path. Using System.AppDomain The AppDomain.CurrentDomain.FriendlyName property provides the name of the current application domain, which typically corresponds to the executable filename including its extension. Example using System; namespace DemoApplication { public class Program { public static void Main() { ...

Read More

Which one is better Build, Rebuild, or Clean in C#?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 17-Mar-2026 319 Views

When working with C# projects in Visual Studio, you have three main build options: Build, Rebuild, and Clean. Each serves a different purpose and understanding when to use each one can significantly improve your development workflow and troubleshoot compilation issues. Build Solution The Build option performs an incremental build, which means it only compiles code files that have changed since the last build. This is the most efficient option for regular development work. Key characteristics of Build − Only compiles modified files and their dependencies Fastest build option for development Preserves existing compiled files that ...

Read More

What are union, intersect and except operators in Linq C#?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 17-Mar-2026 702 Views

LINQ set operators in C# allow you to perform set-based operations on collections. The three primary set operators are Union, Intersect, and Except, which enable you to combine, find common elements, and identify differences between sequences. These operators work with any IEnumerable collections and return distinct results by default, making them useful for data manipulation and filtering operations. Syntax Following is the syntax for the three LINQ set operators − // Union - combines two sequences and removes duplicates var result = sequence1.Union(sequence2); // Intersect - returns common elements from both sequences var result ...

Read More

What is explicit implementation and when to use in the interface in C#?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 17-Mar-2026 410 Views

Explicit interface implementation in C# allows a class to implement interface members in a way that they can only be accessed through the interface reference, not through the class instance directly. This is particularly useful when a class implements multiple interfaces that have members with the same signature. Syntax Following is the syntax for explicit interface implementation − interface IInterface1 { void Method(); } class MyClass : IInterface1 { void IInterface1.Method() { // explicit implementation } } Note ...

Read More

What is the difference between Finalize and Dispose in C#?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 17-Mar-2026 3K+ Views

The Finalize and Dispose methods in C# are both used for cleaning up resources, but they work differently and serve distinct purposes in memory management. Understanding their differences is crucial for proper resource management in .NET applications. Finalize Method The Finalize() method is called automatically by the Garbage Collector before an object eligible for collection is reclaimed. The Garbage Collector takes responsibility for deallocating memory for unreferenced objects. This method is called at some point after there are no longer valid references to that object in memory. The framework does not guarantee when this will happen. While ...

Read More

How to populate XDocument from String in C#?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 17-Mar-2026 2K+ Views

XML is a self-describing language that provides data along with rules to identify what information it contains. The XDocument class in C# contains all the information necessary for a valid XML document, including XML declarations, processing instructions, and comments. The XDocument class is available in the System.Xml.Linq namespace and derives from XContainer, allowing it to contain child nodes. However, XDocument objects can have only one child XElement node, reflecting the XML standard that permits only one root element per document. Syntax Following is the syntax to populate XDocument from a string using XDocument.Parse() − XDocument ...

Read More

What is Facade and how to implement in C#?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 17-Mar-2026 209 Views

The Facade design pattern provides a simplified interface to a complex subsystem. It acts as a wrapper that hides the complexity of multiple classes and their interactions behind a single, easy-to-use interface. This pattern is particularly useful when working with complex APIs, legacy systems, or when you need to provide a unified interface to a set of interfaces in a subsystem. Key Components The Facade pattern consists of the following components − Facade: The main interface that clients interact with. It delegates requests to appropriate subsystem objects. Subsystems: The complex classes that ...

Read More

What is the difference between List and IList in C#?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 17-Mar-2026 20K+ Views

The main difference between List and IList in C# is that List is a concrete class that implements the list functionality, while IList is an interface that defines the contract for list operations. The IList interface inherits from both ICollection and IEnumerable interfaces. List and IList both represent collections of objects that can be accessed by index. They provide methods to insert, remove, search, and sort elements. The key distinction is that List is a specific implementation while IList is a contract that multiple classes can implement. Key Differences List IList ...

Read More
Showing 111–120 of 1,958 articles
« Prev 1 10 11 12 13 14 196 Next »
Advertisements