|
ms
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Newbie question: Enum in InterfacePublic Interface ITest Sub a() Enum MyEnum kk = 1 End Enum End Interface When I try to do the same in C# the complier complains : "myEnum": las interfaces no pueden declarar tipos. public interface ITest { void a(); public enum myEnum { kk = 1 } } I can view the VB file with Lutz Roeder's .NET Reflector Can this be done in C# ? How can VB do this? Best regards, Alejandro Lapeyre No - C# is very limited compared to VB (and J#) regarding what can be
included in interfaces. Basically, methods, delegates, and properties are allowed, but not enums, classes, or structs. David Anton www.tangiblesoftwaresolutions.com Home of the Instant C# VB.NET to C# converter and the Instant VB C# to VB.NET converter Show quoteHide quote "Alejandro Lapeyre" wrote: > In VB I can define an Enum inside an interface > > Public Interface ITest > Sub a() > Enum MyEnum > kk = 1 > End Enum > End Interface > > When I try to do the same in C# the complier complains : "myEnum": las > interfaces no pueden declarar tipos. > > public interface ITest > { > void a(); > public enum myEnum > { > kk = 1 > } > } > > I can view the VB file with Lutz Roeder's .NET Reflector > > Can this be done in C# ? > How can VB do this? > > Best regards, > Alejandro Lapeyre > > > Thanks David!
Show quoteHide quote :-) Alejandro Lapeyre "David Anton" <DavidAn***@discussions.microsoft.com> escribió en el mensaje news:4B01AE79-C100-4895-97A1-3166ECCC0426@microsoft.com... > No - C# is very limited compared to VB (and J#) regarding what can be > included in interfaces. Basically, methods, delegates, and properties are > allowed, but not enums, classes, or structs. > > David Anton > www.tangiblesoftwaresolutions.com > Home of the Instant C# VB.NET to C# converter > and the Instant VB C# to VB.NET converter > > "Alejandro Lapeyre" wrote: > >> In VB I can define an Enum inside an interface >> >> Public Interface ITest >> Sub a() >> Enum MyEnum >> kk = 1 >> End Enum >> End Interface >> >> When I try to do the same in C# the complier complains : "myEnum": las >> interfaces no pueden declarar tipos. >> >> public interface ITest >> { >> void a(); >> public enum myEnum >> { >> kk = 1 >> } >> } >> >> I can view the VB file with Lutz Roeder's .NET Reflector >> >> Can this be done in C# ? >> How can VB do this? >> >> Best regards, >> Alejandro Lapeyre >> >> >>
Other interesting topics
Newbie question: Thread access of form components
"Object does not match target type." using dynamic compiling & inv InitializeComponent changes TabPage order without warning Nontrivial structure? using C# DLL from plain C Covariance in delegates doesn't work with ValueType's? events and eventargs Converting string "2 1/2" to double Fingerprint Readers C# Eletitlement app - Can this be done |
|||||||||||||||||||||||