what is Singleton class? [Resolved]

Posted by Oswaldlily under ASP.NET on 3/8/2013 | Points: 10 | Views : 7101 | Status : [Member] | Replies : 3
In whole single web application I have used 3 asp.net pages.
Shall I say that I have used Singleton class here in my application..is Class1 here is singleton???
if no what is Singleton class?


page1.aspx.cs

public class1{
function1(int a){}

}


page2.aspx.cs
public class2{
class1 c =new class1();
c.function1(1);
}

page3.aspx.cs
public class3{
class1 c =new class1();
c.function1(2);
}




Responses

Posted by: Jayakumars on: 3/8/2013 [Member] [MVP] Bronze | Points: 50

Up
0
Down

Resolved
hi

check this url

http://www.codeproject.com/Tips/219559/Simple-Singleton-Pattern-in-Csharp
http://www.dotnetperls.com/singleton
http://msdn.microsoft.com/en-us/library/ff650316.aspx

Mark as Answer if its helpful to you

Oswaldlily, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Kundan64 on: 3/8/2013 [Member] Starter | Points: 25

Up
0
Down
A singleton class is a class that can be instantiated once, and only once.
Its the combination of two essential properties:
* Ensure a class only has one instance.
* Provide a global point of access to it.

Oswaldlily, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Oswaldlily on: 3/8/2013 [Member] Starter | Points: 25

Up
0
Down

This clear my doubt overall....
"can be instantiated once, and only once. "

Oswaldlily, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response