| Next Tip?
Home » Archive

Articles in the CSharp Category

CSharp, Microsoft .Net »

[22 May 2011 | No Comment | 626 views]

We have many books around, anyone can get a definition of interface which is nothing but bookish. In these days we are more interested to know what you know about interfaces rather than what you read for interfaces?
Here, I tried to cover interfaces in my own words:
Interface
An interface is simply a collection of function prototypes. An Interface is a reference type like a class, but interface can contain only abstract members. In other words, Interface is a contract that defines the signature of the functionality.
An interface looks like a class …

CSharp, Microsoft .Net »

[18 May 2011 | No Comment | 401 views]

A very basic and common questions asked many time to freshers, novoice or intermediate level interviews. I got many emails for the same questions, hereunder I try to answer in a simpler way.
Structures
A structure in C# is simply a composite data type [you are well aware from composite data type, refer to data types for more details], which consists number of members of other types. The structure define simply by using the struct keyword.
eg. struct enroll
{
   public string name, fname, mname;
   public string char sex;
   Public int age;
   public string address;
}
Classes
It is cleared from …

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

[25 Jan 2010 | No Comment | 3,315 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 | 851 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 | 677 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 | 552 views]

The method can be over-ridden.
Tweet This Post

CSharp, VB.Net Interview »

[2 Sep 2009 | No Comment | 480 views]

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

CSharp »

[2 Sep 2009 | No Comment | 474 views]

classes in the same namespace.
Tweet This Post

CSharp »

[2 Sep 2009 | No Comment | 340 views]

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

CSharp »

[2 Sep 2009 | No Comment | 426 views]

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