![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have a runtime generated class (a WCF proxy) that extends a generic type. The generated code is: [DebuggerStepThrough, GeneratedCode("System.ServiceModel", "3.0.0.0")] public class _MyTypeClient : ClientBase<_MyType>, _MyType { .... } Now I would like to call some methods from an instance of this class. The problem is that _MyType is also generated code, so I can't cast to the correct type: ((ClientBase<_MyType>)myInstance).ClientCredential s.UserName.UserName = "jimmy"; |
#3
| |||
| |||
|
|
Hallo Carlo! I have a runtime generated class (a WCF proxy) that extends a generic type. The generated code is: [DebuggerStepThrough, GeneratedCode("System.ServiceModel", "3.0.0.0")] public class _MyTypeClient : ClientBase<_MyType>, _MyType { .... } Now I would like to call some methods from an instance of this class. The problem is that _MyType is also generated code, so I can't cast to the correct type: ((ClientBase<_MyType>)myInstance).ClientCredential s.UserName.UserName = "jimmy"; Why not just: myInstance.ClientCreditials.UserName.UserName = "jimmy"; ? GP |
#4
| |||
| |||
|
|
the proxy type is dinamically created, so the variable is of type object. To access the method on it I have to cast it to the appropriate type. |
#5
| |||
| |||
|
#6
| |||
| |||
|
#7
| |||
| |||
|
|
Hi Carlo, Have you got any further ideas on this issue? If you have any further questions, please feel free to post here. Sincerely, Steven Cheng Microsoft MSDN Online Support Lead This posting is provided "AS IS" with no warranties, and confers no rights. |
#8
| |||
| |||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |