Click here to Skip to main content
15,903,388 members
Home / Discussions / C#
   

C#

 
GeneralRe: Binding ListBox to a class property problem Pin
Werdna22-Mar-04 7:10
Werdna22-Mar-04 7:10 
GeneralRe: Binding ListBox to a class property problem Pin
phoenius22-Mar-04 7:12
phoenius22-Mar-04 7:12 
GeneralRe: Binding ListBox to a class property problem Pin
phoenius22-Mar-04 8:20
phoenius22-Mar-04 8:20 
AnswerRe: How to: Registry Pin
Heath Stewart22-Mar-04 3:34
protectorHeath Stewart22-Mar-04 3:34 
GeneralRe: How to: Registry Pin
bouli22-Mar-04 3:42
bouli22-Mar-04 3:42 
GeneralRe: How to: Registry Pin
Heath Stewart22-Mar-04 3:50
protectorHeath Stewart22-Mar-04 3:50 
GeneralRe: How to: Registry Pin
bouli22-Mar-04 4:14
bouli22-Mar-04 4:14 
GeneralRe: How to: Registry Pin
Heath Stewart22-Mar-04 4:27
protectorHeath Stewart22-Mar-04 4:27 
You're right - I wasn't thinking. A REG_MULTI_SZ would be an array. In that case, first do a simple check for the System.Array type, then you could get the first element and check it's type. It'll either be a String or Byte so use typeof since Byte is a value type.

Using is is slightly faster (1 or 2 instructions as opposed to 2 or 4 - you make the call how important that is) than using typeof, but can only be used when the second operand is a reference type. Below is an IL comparison of using each(str is a variable referencing a String):
// str is string
ldloc.0 // location of str in local variable stack
isinst [mscorlib]System.String
 
// str.GetType() == typeof(string)
ldloc.0
callvirt instance class [mscorlib]System.Type [mscorlib]System.Object::GetType()
ldtoken [mscorlib]System.String
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(
  valuetype [mscorlib]System.RuntimeHandle)


 

Microsoft MVP, Visual C#
My Articles
GeneralSource code filters in VS help do not persist Pin
profoundwhispers22-Mar-04 3:24
profoundwhispers22-Mar-04 3:24 
GeneralRe: Source code filters in VS help do not persist Pin
Heath Stewart22-Mar-04 3:57
protectorHeath Stewart22-Mar-04 3:57 
QuestionWindow Output???? Pin
SherKar22-Mar-04 2:58
SherKar22-Mar-04 2:58 
AnswerRe: Window Output???? Pin
Michael Flanakin22-Mar-04 3:35
Michael Flanakin22-Mar-04 3:35 
GeneralRe: Window Output???? Pin
Dave Kreskowiak22-Mar-04 8:11
mveDave Kreskowiak22-Mar-04 8:11 
GeneralRe: Window Output???? Pin
SherKar22-Mar-04 11:37
SherKar22-Mar-04 11:37 
GeneralRe: Window Output???? Pin
Michael Flanakin22-Mar-04 11:47
Michael Flanakin22-Mar-04 11:47 
GeneralApplication.Run Pin
scadaguy22-Mar-04 2:37
scadaguy22-Mar-04 2:37 
GeneralRe: Application.Run Pin
Heath Stewart22-Mar-04 3:39
protectorHeath Stewart22-Mar-04 3:39 
GeneralRe: Application.Run Pin
scadaguy22-Mar-04 5:11
scadaguy22-Mar-04 5:11 
GeneralRe: Application.Run Pin
Heath Stewart22-Mar-04 5:19
protectorHeath Stewart22-Mar-04 5:19 
GeneralRe: Application.Run Pin
scadaguy22-Mar-04 5:41
scadaguy22-Mar-04 5:41 
GeneralRe: Application.Run Pin
HAHAHA_NEXT22-Mar-04 8:38
HAHAHA_NEXT22-Mar-04 8:38 
Generalactive directory users listing Pin
agakyurek21-Mar-04 23:42
agakyurek21-Mar-04 23:42 
GeneralRe: active directory users listing Pin
Heath Stewart22-Mar-04 3:54
protectorHeath Stewart22-Mar-04 3:54 
QuestionHow to: Registry Pin
bouli21-Mar-04 22:55
bouli21-Mar-04 22:55 
Generalunknown exception thrown when decrypting read-in message Pin
chau_fai_rubbish21-Mar-04 21:36
chau_fai_rubbish21-Mar-04 21:36 

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.