Contributor: Ganesh
1. how can we manage which member of the class to be serialized and which should not be
serialized without using Attributes (i.e. before .net 2.0) ?
2. What are single cast and multicast delegates
3. What abt anonymus methods (used in threading)
4. What is mutex
5. if i use same name for the abstract methods in two base classes can i implement these two
base classes in a single child class, is there ambiguity while calling the same method ?
6. Why should we do boxing ?
For self protection........Just kidding...:-)
With Boxing and unboxing one can link between value-types and reference-types by allowing any value of a value-type to be converted to and from type object. Boxing and unboxing enables a unified view of the type system wherein a value of any type can ultimately be treated as an object.
7. Default access modifier for a class?
For a Class written in a namespace has a default access modifier as Internal
8. If we use nested classes how to create an object for the inner class ?
public class MyOuterClass
{
public class MyInnerClass
{
public void MethodInInnerClass()
{
}
}
}
MyOuterClass.MyInnerClass Obj = new MyOuterClass.MyInnerClass();
Obj.MethodInInnerClass();
9. if i add reference to a A.dll, which again have reference to another B.dll, do i need to have
both the dll s in my bin? if i am calling a method on A.dll and it is calling a methode from
B.dll internally, what if B.dll is not there in my bin folder ? (about dynamic linking libraries)
10. Difference between structures and classes
- Classes are reference types and Structs are value types.
- When you call the New operator on a class, it will be allocated on the heap. However, when you instantiate a struct, it gets created on the stack.
- Structs can declare constructors, but they must take parameters. It is an error to declare a default (parameterless) constructor for a struct.
- There is no inheritance for structs as there is for classes. A struct cannot inherit from another struct or class, and it cannot be the base of a class.
11. There are two methods in two interfaces with same name. How do you implement those two methods in a class. After implementing, how do you access those methods by creating object. Is normal object creation sufficient to access those methods?
interface AAAA
{
void Method();
}
interface BBBB
{
void Method();
}
public class CCCC : AAAA,BBBB
{
//Access modifier is not needed here
//If mention it, throws compile error..
void AAAA.Method()
{
}
void BBBB.Method()
{
}
}
If you create an object for Class CCCC and try to access methods, you will fail to do so...Follow the below figure..
Observe the above code....there is no "Method" in that given intellisence list.
For access method implementation in Interface BBBB, you have to create object for Class CCCC like this...
12. What is the default access modifier for the inner class ?
Private
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.