You realize the second if is never going to get called? The first if only conditionally includes m_sdkConstName = WMT_TYPE_STRING. The return is outside of the scope of that if, and will always be executed. You probably want: if ( type == typeof(String)) { m_sdkConstName = WMT_TYPE_STRING; return; }
if ( type == typeof(Int32)) { m_sdkConstName = WMT_TYPE_DWORD; return; } That's the reason I *always* put braces in my if statements, even if there's only one line. http://www.peterRitchie.com/ On Tue, 14 Jun 2005 21:57:06 EDT, Ron Young <[EMAIL PROTECTED]> wrote: >I've got this code in MC++ > >__property void set_DataType( Type* type ) >{ > if ( type == typeof(String)) > m_sdkConstName = WMT_TYPE_STRING; return; > > if ( type == typeof(Int32)) > m_sdkConstName = WMT_TYPE_DWORD; return; >} > >and calling it from C#: > >obj.DataType = typeof(Int32); > >when I step-through the code, the condition always comes out to >typeof(String). > >Any ideas as to why? =================================== This list is hosted by DevelopMentorŪ http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com