C# Advanced

What is Use of Private Constructor in C# ? Scenarios Example

Answer to interview questions, what is use of private constructor in c# language includes definition of it and when or why to use private constructors in c sharp  application with c# program example. Private Constructor in C#? Private constructor is constructor that is preceded by private access specifier. For example, below class has a private […]

Design thread safe Singleton Class in C# Considering Performance

In, C# programming, Singleton in multi-threaded environment can produce more than one objects of singleton class if not designed properly. Where singleton class is expected to return only one of its instance. In this section, we will design the thread safe singleton class which was not designed in the answer of C# technical interview question […]

How to Create Custom Exception in C# .net program? Use of it?

Implementation of user defined or custom exception in C# .net programming is simple and is implemented by extending system Exception class. We’ll answer concept of run time custom exception with a program example in C#. Custom Exception Class Custom Exception class is nothing but a user defined class which is derived from System Exception class. […]

Advantage of Immutable String in C# programming

Advantage of immutable string in C# programming is data security. Let’s understand benefits of immutable string with a C# program example. Recommended to read immutable and mutable string in C#. Here is the scenario, Since, C# string is immutable, that is it cannot be modified, hence, the string modified by the display1() method will not […]

Write code to retrieve data from SQL database in C# asp net

Here are the steps to connect SQL database server, access database and retrieve data from a table programmatically in C# asp net. Steps: Create an object of SqlConnection class Prepare connection string for SqlConnection class object. Create object of SqlCommand class and prepare sql command with types, queries and sql connection object. Open sql connection […]

What is method hiding in C# inheritance? Uses with example

Method hiding in C# inheritance and when to use method hiding interview question is frequently asked interview question we should focus on. Method hiding in C# program is also called method name hiding. We will answer what is method hiding in C# language with example program. Answer: Method hiding occurs in inheritance relationship when the […]

1 Scenario where C# interface is indispensable?

Interview Question: Tell one scenario where C# interface  is indispensable. For the scenario, only C# interface is the solution and abstract class cannot be used. Answer: Scenario is multiple interface inheritance. C# object oriented programming does not support multiple class inheritance, means, a class cannot inherit more than one class in C#. But, a class […]

Scroll to top