| Next Tip?
Home » Archive

Articles in the CSharp Category

Asp.Net, CSharp, Company asked interview questions, RSystems »

[25 Jan 2010 | No Comment | 644 views]

Q. Can I inherit two difference classes to partial classes? Following is the whole scenario of this question:
I have two classes XYZ and ABC and two partial classes  of class myClass now is it possible:
partial class myClass : XYZ
{
}
partial class myClass : ABC
{
}
Ans:  This question I have asked in RSystems, Noida and I am sharing hereunder with you :
We can’t inherit two difference classes to partial class because in C# multiple inheritance is not possible using classes.
The main reason is in C# we cant do the following:
class myClass : XYZ, …

CSharp, Microsoft .Net »

[11 Jan 2010 | No Comment | 293 views]

I have also asked a tricky question like this:
Can we create a singleton class using public constructor?
Simply answer is yes.
Practically, many of us aware that we can create a singleton class by using private constructor an creating a property, but we can create a singleton class by using public constructor as folows:
static void Main(string[] args)
{
try
{
Singleton obj3 = new Singleton2();
Singleton obj4 = new Singleton2();
Console.Read();
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
Console.Read();
}
}
static void Main(string[] args)
{
try
{
Singleton obj3 = new Singleton2();
Singleton obj4 = new Singleton2();
Console.Read();
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
Console.Read();
}
}
Tweet This Post

CSharp, OOPs, VB.Net Interview »

[2 Sep 2009 | No Comment | 297 views]

In overriding, you change the method behavior for a derived class.
While, overloading simply involves having a method with the same name within the class.
Tweet This Post

CSharp, OOPs, VB.Net Interview »

[2 Sep 2009 | No Comment | 258 views]

The method can be over-ridden.
Tweet This Post

CSharp, VB.Net Interview »

[2 Sep 2009 | No Comment | 255 views]

Yes ,but they are not accessible, out-side the class.
Tweet This Post

CSharp »

[2 Sep 2009 | No Comment | 150 views]

classes in the same namespace.
Tweet This Post

CSharp »

[2 Sep 2009 | No Comment | 111 views]

No, but we can use interfaces for that.
Tweet This Post

CSharp »

[2 Sep 2009 | No Comment | 128 views]

Place a colon(:)and then the name of the base class.
eg:
public baseclass
{
/ /signatures
}
public childclass : baseclass
{
//signature
}
Tweet This Post

CSharp, VB.Net Interview »

[30 Aug 2009 | No Comment | 129 views]

Thread.Abort ( ) stops the thread execution at that moment itself.
Tweet This Post

CSharp, VB.Net Interview »

[30 Aug 2009 | No Comment | 153 views]

Yes, we can use event with thread,this is one of the techniques to synchronize one thread with other.
Tweet This Post

Get Adobe Flash playerPlugin by wpburn.com wordpress themes