 |
What is the difference between Overloading and Shadowing?
|
| |
Overloading : A Member has the name, but something else in the signature is different.
Shadowing : A member shadows another member if the derived member replaces the base member
|
 |
What is the difference between Overloading and Overriding?
|
| |
Overloading : Method name remains the same with different signatures.
Overriding : Method name and Signatures must be the same.
|
 |
what is Boxing and Unboxing?
|
| |
Boxing is an implicit conversion of a value type to the type object
int i = 123; // A value type
Object box = i // Boxing
--------------------------------------------------------------------------------
Unboxing is an explicit conversion from the type object to a value type
int i = 123; // A value type
Object box = i; // Boxing
int j = (int)box; // Unboxing
|
 |
what is the difference between array and arraylist?
|
| |
Arrays are always fixed size in nature and ArrayList can grow dynamically.
|
 |
what is the difference between readonly and constant varaibles??
|
| |
readonly - variables are dynamic constant, you can modify the value in the constructor only.
constant - variables are constant, you cannot change the values once its declared as a constant.
|
 |
What is enum?
|
| |
An enum type is a distinct type that declares a set of named constants.They are strongly typed constants. They are unique types that allow to declare symbolic names to integral values.
public enum Grade
{
A,
B,
C
}
|
 |
What is the life cycle for an object?
|
| |
1. The object is created.
2. Memory is allocated for the object.
3. The constructor is run.
4. The object is now live.
5. if the object is no longer in use, it needs finalization.
6. Finalizers are run.
7. The object is now inaccessible and is available for the garbage collector to carry out clean-up.
8. The garbage collector frees up associated memory.
|
 |
What is CodeDOM?
|
| |
CodeDOM is an object model, which is used to generate a source code. It is designed to be language independent - once you create a CodeDom hierarchy for a program we can then generate the source code in any .NET complaint language.
|
 |
What is Static class?
|
| |
1.A static class can only contain static members.
2.We cannot create an instance of a static class.
3.Static class is always sealed and they cannot contain instance constructor
4.Hence we can also say that creating a static class is nearly same as creating a class with only static members and a private constructor (private constructor prevents the class from being instantiated).
---Good example is the System.Math class
|
 |
What are method parameters in C#?
|
| |
C# is having 4 parameter types which are
1.Value Parameter. default parameter type. Only Input
2.Reference(ref) Parameter. Input\Output
3.Output(out) Parameter.
4.Parameter(params) Arrays
|