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. […]

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 […]

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