Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / CLR / June 2004

Tip: Looking for answers? Try searching our database.

static members

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Greg Young - 22 Jun 2004 20:24 GMT
Has anyone dealt with putting static implementations in interfaces ? you
"can" do it (I am sure in IL) ... I'm wonderring if vb.net and c# play nice
when you do it ...
Scott M. - 22 Jun 2004 22:05 GMT
VB .NET does not allow Shared (the VB term for static) members in an
interface.

> Has anyone dealt with putting static implementations in interfaces ? you
> "can" do it (I am sure in IL) ... I'm wonderring if vb.net and c# play nice
> when you do it ...
Greg Young - 22 Jun 2004 22:30 GMT
I can do it though IL and I have a few cases where it would be quite
beneficial ... the question is how will vb/C# handle (moreso in the
development environment/compiler warnings as I am sure the CLR will handle
it fine) I could easily write a test, the question was just a time saver.

> VB .NET does not allow Shared (the VB term for static) members in an
> interface.
[quoted text clipped - 3 lines]
> nice
> > when you do it ...
Scott M. - 23 Jun 2004 01:10 GMT
You could also consider creating an abstract class.  Shared/static members
are allowed in this context and you get the same result.

> I can do it though IL and I have a few cases where it would be quite
> beneficial ... the question is how will vb/C# handle (moreso in the
[quoted text clipped - 8 lines]
> > nice
> > > when you do it ...
Kit George (MSFT) - 23 Jun 2004 19:28 GMT
I would strongly suggest the abstract approach, as opposed to fillding with
IL Greg. Even if a specific langauge (VB or C#) respects this at a point in
time, I would work within the constraints of what the compilers officialy
support, since you know that that support will continue to be there from
version to version. If you change things in il, then we may muck things up
for you in the future.
Greg Young - 23 Jun 2004 21:24 GMT
I agree and would have done it this way, however the code I am dealing with
is not mine and would require  MAJOR architectural changes in order to do
this. I guess I will just hack it and put the methods external to the
interfaces although I have to admit I was also morbidly curious :D

> I would strongly suggest the abstract approach, as opposed to fillding with
> IL Greg. Even if a specific langauge (VB or C#) respects this at a point in
> time, I would work within the constraints of what the compilers officialy
> support, since you know that that support will continue to be there from
> version to version. If you change things in il, then we may muck things up
> for you in the future.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.