Click here to Skip to main content
15,896,063 members
Home / Discussions / C#
   

C#

 
GeneralRe: Skipping locked section already in use Pin
Sentenryu16-May-12 0:29
Sentenryu16-May-12 0:29 
AnswerRe: Skipping locked section already in use Pin
Ravi Bhavnani15-May-12 11:36
professionalRavi Bhavnani15-May-12 11:36 
GeneralRe: Skipping locked section already in use Pin
PIEBALDconsult15-May-12 12:51
mvePIEBALDconsult15-May-12 12:51 
GeneralRe: Skipping locked section already in use Pin
Ravi Bhavnani15-May-12 13:04
professionalRavi Bhavnani15-May-12 13:04 
GeneralRe: Skipping locked section already in use Pin
PIEBALDconsult15-May-12 14:32
mvePIEBALDconsult15-May-12 14:32 
GeneralRe: Skipping locked section already in use Pin
Ravi Bhavnani15-May-12 14:43
professionalRavi Bhavnani15-May-12 14:43 
GeneralRe: Skipping locked section already in use Pin
PIEBALDconsult15-May-12 14:56
mvePIEBALDconsult15-May-12 14:56 
GeneralRe: Skipping locked section already in use Pin
Ravi Bhavnani15-May-12 15:02
professionalRavi Bhavnani15-May-12 15:02 
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
mvePete 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
mvePete 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
mvePete 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
mvePete 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 

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.