Click here to Skip to main content
15,881,882 members
Home / Discussions / C#
   

C#

 
GeneralRe: Alternative to using a string as a key? Pin
venomation3-Jan-12 9:25
venomation3-Jan-12 9:25 
GeneralRe: Alternative to using a string as a key? Pin
SledgeHammer013-Jan-12 9:48
SledgeHammer013-Jan-12 9:48 
AnswerRe: Alternative to using a string as a key? Pin
Luc Pattyn3-Jan-12 10:38
sitebuilderLuc Pattyn3-Jan-12 10:38 
GeneralRe: Alternative to using a string as a key? Pin
SledgeHammer013-Jan-12 12:15
SledgeHammer013-Jan-12 12:15 
AnswerRe: Alternative to using a string as a key? Pin
jschell3-Jan-12 10:40
jschell3-Jan-12 10:40 
GeneralRe: Alternative to using a string as a key? Pin
venomation3-Jan-12 11:01
venomation3-Jan-12 11:01 
GeneralRe: Alternative to using a string as a key? Pin
jschell4-Jan-12 8:12
jschell4-Jan-12 8:12 
GeneralRe: Alternative to using a string as a key? Pin
SledgeHammer014-Jan-12 9:26
SledgeHammer014-Jan-12 9:26 
Its generally not a good idea to use strings as keys to get components like that. My boss is a notorious mispeller. Do you really want to spend time tracking down why your app doesn't work because somebody spelled it "scren" in 3 out of 100 places? GUIDs as I suggested earlier actually wouldn't be AS prone. Why? I'd probably type in "screen" myself because I can do that faster then copy & pasting from somewhere. With a GUID? I'm not going to type that in. Thats going to be a strict c&p.

Is adding a component multiple times "theoretical"? or is it really going to happen?

Would it be more practical to have a single instance of OffscreenSensor that can sense things from multiple locations?

Instead of doing something like:

Components["Screen1"].EventHappened +=

you could do something like:

IScreenSensor sensor = ServiceLocator.GetService<IScreenSensor>();

sensor.GetScreen(1).EventHappened +=
sensor.GetScreen(2).EventHappened +=

etc.

string keys are also prone to lazy search and replace issues Smile | :) .
GeneralRe: Alternative to using a string as a key? Pin
jschell6-Jan-12 8:29
jschell6-Jan-12 8:29 
AnswerRe: Alternative to using a string as a key? Pin
Shameel3-Jan-12 16:22
professionalShameel3-Jan-12 16:22 
AnswerRe: Alternative to using a string as a key? Pin
BillWoodruff3-Jan-12 19:28
professionalBillWoodruff3-Jan-12 19:28 
AnswerRe: Alternative to using a string as a key? Pin
V.3-Jan-12 20:34
professionalV.3-Jan-12 20:34 
AnswerRe: Alternative to using a string as a key? Pin
Subin Mavunkal4-Jan-12 18:06
Subin Mavunkal4-Jan-12 18:06 
Questionhow to take a table name from a text box! Pin
mpvkrishnadhar3-Jan-12 7:39
mpvkrishnadhar3-Jan-12 7:39 
AnswerRe: how to take a table name from a text box! Pin
PIEBALDconsult3-Jan-12 7:43
mvePIEBALDconsult3-Jan-12 7:43 
GeneralRe: how to take a table name from a text box! Pin
mpvkrishnadhar3-Jan-12 7:46
mpvkrishnadhar3-Jan-12 7:46 
AnswerRe: how to take a table name from a text box! Pin
Luc Pattyn3-Jan-12 8:05
sitebuilderLuc Pattyn3-Jan-12 8:05 
AnswerRe: how to take a table name from a text box! Pin
Luc Pattyn3-Jan-12 8:04
sitebuilderLuc Pattyn3-Jan-12 8:04 
SuggestionRe: how to take a table name from a text box! Pin
AHSAN1114-Jan-12 4:38
professionalAHSAN1114-Jan-12 4:38 
GeneralRe: how to take a table name from a text box! Pin
Luc Pattyn4-Jan-12 4:49
sitebuilderLuc Pattyn4-Jan-12 4:49 
AnswerRe: how to take a table name from a text box! Pin
AHSAN1113-Jan-12 22:02
professionalAHSAN1113-Jan-12 22:02 
GeneralRe: how to take a table name from a text box! Pin
Luc Pattyn4-Jan-12 3:14
sitebuilderLuc Pattyn4-Jan-12 3:14 
GeneralRe: how to take a table name from a text box! Pin
AHSAN1114-Jan-12 4:31
professionalAHSAN1114-Jan-12 4:31 
AnswerRe: how to take a table name from a text box! Pin
Luc Pattyn4-Jan-12 4:41
sitebuilderLuc Pattyn4-Jan-12 4:41 
GeneralRe: how to take a table name from a text box! Pin
mpvkrishnadhar4-Jan-12 4:23
mpvkrishnadhar4-Jan-12 4:23 

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.