Click here to Skip to main content
15,867,453 members
Home / Discussions / C#
   

C#

 
GeneralRe: Skipping locked section already in use Pin
PIEBALDconsult15-May-12 17:21
mvePIEBALDconsult15-May-12 17:21 
GeneralRe: Skipping locked section already in use Pin
jschell16-May-12 9:04
jschell16-May-12 9:04 
GeneralRe: Skipping locked section already in use Pin
Pete O'Hanlon15-May-12 8:20
subeditorPete O'Hanlon15-May-12 8:20 
GeneralRe: Skipping locked section already in use Pin
Sentenryu15-May-12 8:39
Sentenryu15-May-12 8:39 
GeneralRe: Skipping locked section already in use Pin
jschell15-May-12 9:02
jschell15-May-12 9:02 
GeneralRe: Skipping locked section already in use Pin
Pete O'Hanlon15-May-12 21:43
subeditorPete O'Hanlon15-May-12 21:43 
GeneralRe: Skipping locked section already in use Pin
jschell16-May-12 9:07
jschell16-May-12 9:07 
GeneralRe: Skipping locked section already in use Pin
BobJanova16-May-12 0:39
BobJanova16-May-12 0:39 
They artificially restrict your ability to change your mind later, and don't really provide any benefit. You can always just instantiate one copy of an object if you only need one!

If you have a need for a single static instance of some stuff, have a static reference to it.

static class GlobalData {
 public static ContactListManager ContactListManager { get; private set; }
 
 static GlobalData(){
  ContactListManager = new ContactListManager("datastore.xml");
 }
}


That way, if you discover that you want to manage disparate contacts across several data sources and therefore it shouldn't be a singleton any more, it's much easier to change. It means that if you want a temporary separate instance for some reason (e.g. importing external data), you can do so.
Questioncollapsing xml elements into attributes in c# Pin
swjam15-May-12 2:26
swjam15-May-12 2:26 
AnswerRe: collapsing xml elements into attributes in c# Pin
Pete O'Hanlon15-May-12 2:31
subeditorPete O'Hanlon15-May-12 2:31 
GeneralRe: collapsing xml elements into attributes in c# Pin
swjam15-May-12 2:49
swjam15-May-12 2:49 
GeneralRe: collapsing xml elements into attributes in c# Pin
Pete O'Hanlon15-May-12 2:51
subeditorPete O'Hanlon15-May-12 2:51 
AnswerRe: collapsing xml elements into attributes in c# Pin
PIEBALDconsult15-May-12 3:35
mvePIEBALDconsult15-May-12 3:35 
JokeRe: collapsing xml elements into attributes in c# Pin
swjam15-May-12 4:39
swjam15-May-12 4:39 
GeneralRe: collapsing xml elements into attributes in c# Pin
Dave Kreskowiak15-May-12 5:02
mveDave Kreskowiak15-May-12 5:02 
GeneralRe: collapsing xml elements into attributes in c# Pin
PIEBALDconsult15-May-12 5:37
mvePIEBALDconsult15-May-12 5:37 
GeneralRe: collapsing xml elements into attributes in c# Pin
Dave Kreskowiak15-May-12 7:26
mveDave Kreskowiak15-May-12 7:26 
GeneralRe: collapsing xml elements into attributes in c# Pin
PIEBALDconsult15-May-12 5:38
mvePIEBALDconsult15-May-12 5:38 
GeneralRe: collapsing xml elements into attributes in c# Pin
Mycroft Holmes15-May-12 14:28
professionalMycroft Holmes15-May-12 14:28 
GeneralRe: collapsing xml elements into attributes in c# Pin
PIEBALDconsult15-May-12 14:34
mvePIEBALDconsult15-May-12 14:34 
QuestionRedirecting output from an unmanaged dll Pin
andreas0414-May-12 23:19
andreas0414-May-12 23:19 
AnswerRe: Redirecting output from an unmanaged dll Pin
BobJanova15-May-12 0:27
BobJanova15-May-12 0:27 
AnswerRe: Redirecting output from an unmanaged dll Pin
Richard MacCutchan15-May-12 1:37
mveRichard MacCutchan15-May-12 1:37 
AnswerRe: Redirecting output from an unmanaged dll Pin
Sentenryu15-May-12 5:40
Sentenryu15-May-12 5:40 
Questionproviding images as a stream Pin
VinVan8114-May-12 22:12
VinVan8114-May-12 22:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.