![]() |
Re: C# interview questions
Interesting interview questions. It helped me remember all the answers. Thanks a lot. Would like to see some .NET 3.0 or 4.0 questions too.
|
Re: C# interview questions
Actually, Protected Internal can be accessed by any code in the assembly in which it is declared, or from within a derived class in another assembly. Access from another assembly must take place within a class declaration that derives from the class in which the protected internal element is declared, and it must take place through an instance of the derived class type.
|
Great Post
great post. I like it
|
Re: C# interview questions
It's great help to face the interview.
thanks |
Re: C# interview questions
Here some more good questions questpond dot com
|
Re: C# interview questions
Quote:
Code:
object[] array = new object[] { 1, "abc", new Random() }; |
Re: C# interview questions
Class question "Can you allow a class to be inherited, but prevent the method from being over-ridden?" answer (Yes. Just leave the class public and make the method sealed.) is wrong. You cannot use the "sealed" modifier in a public class that is not over-riding the class that implements the method or property that you want to seal. If you want to stop someone from over-riding a method or property just do not add the "virtual" modifier to it
The following will raise an error. If you switched the GetPerson in the Person class to include the "virtual" modifier then it would work. public class Person{ public string GetPerson(){ } } public class Member: Person{ override public string GetPerson(){ } } |
Re: C# interview questions
Quote:
Mutable Objects: When you have a reference to an instance of an object, the contents of that instance can be altered Immutable Objects: When you have a reference to an instance of an object, the contents of that instance cannot be altered |
Re: C# interview questions
great package of questions u have shared............. it will definately help c# bginner...
|
Re: C# interview questions
Hieverybody,
Likethe_nell_87, I think the answer in 10th question is not ok (Can you storemultiple data types in System.Array?). If you havea this hierarchy: class Person {}; class Male : Person {}; class Female : Person {}; each Maleor Female object is also a Person object. With an ArrayListobject, I can insert multiple types of the same hierarchy, and then convert theArrayList to an Array using the base type of Person. The following code works fine: Code:
class Person { } |
| All times are GMT +5.5. The time now is 04:22. |