Can namespace declaration have access modifiers ? No . Namespace declaration cannot have access modifiers. Help Namespaces implicitly have public declared accessibility. No access modifiers […]
Category: CSharp Interview Questions
Question : Whether b.x =1 statement in class A and class B is okay or not ?
Question : Whether b.x =1 statement in class A and class B is okay or not ? public class A { int x; static void […]
Question : State whether below code would give compilation error or not ?
Question : State whether below code would give compilation error or not ? delegate string Delegate1(object o); delegate object Delegate2(string s); static string Dispaly(object o) […]
What is use of private constructor in C# ?
What is use of private constructor in C# ? If a class contains only static members and isn’t intended to be instantiated, adding an empty […]
State whether the C# code : var z = null; is okay or not ?
State whether the C# code : var z = null; is okay or not ? Above code would give an error as null does not […]
Difference between Static and Instance Constructor ?
Difference between Static and Instance Constructor The static constructor executes at most once in a given application domain. The execution of a static constructor is […]
What is CharEnumerator in C# ?
CharEnumerator is an object in C# that can be used to enumerate through all the characters of a string. Sample Code : string str = […]
What is params keyword in C# ?
The params keyword lets you specify a method parameter that takes a variable number of arguments. No additional parameters are permitted after the params keyword […]
How to round off decimal to two decimal places in C# ?
There are 3 ways to round off decimal to two decimal places : 1. Use ToString() double d = 2.445; d.ToString(“0.00”) Output : 2.45 2. Use […]
C# Static and Instance Members
C# Static and Instance Members Members of a class are either static members or instance members. Generally speaking, it is useful to think of static […]
