Click here to Skip to main content
16,004,919 members
Home / Discussions / C#
   

C#

 
GeneralRe: regd Datagrid Pin
Heath Stewart17-May-04 8:53
protectorHeath Stewart17-May-04 8:53 
GeneralRe: regd Datagrid Pin
Jay Shankar17-May-04 23:11
Jay Shankar17-May-04 23:11 
GeneralRe: regd Datagrid Pin
karteek17-May-04 23:19
karteek17-May-04 23:19 
GeneralRe: regd Datagrid Pin
Jay Shankar17-May-04 23:38
Jay Shankar17-May-04 23:38 
Generalmanaging the edit of a dataGrid Pin
HappyPaws17-May-04 8:36
HappyPaws17-May-04 8:36 
GeneralRe: managing the edit of a dataGrid Pin
Heath Stewart17-May-04 8:51
protectorHeath Stewart17-May-04 8:51 
GeneralDirectShow filters Pin
ro_angel_bv17-May-04 8:36
ro_angel_bv17-May-04 8:36 
Generalinterface members as internal Pin
Mike Hodnick17-May-04 7:50
Mike Hodnick17-May-04 7:50 
Is it possible to implement methods from an interface class as internal in C#? From my first try, it doesn't look like it is possible (the project won't build):

<br />
public interface IMyInterface{<br />
    string Name{ get; set; }<br />
}<br />
<br />
public class MyClass : IMyInterface{<br />
    internal string Name{ <br />
        get{} <br />
        set{}<br />
    }<br />
}<br />
<br />

...this results in a build error.

But this IS possible to do in VB.Net:

<br />
Public Interface IMyInterface<br />
     Property Name() as String<br />
End Interface<br />
<br />
Public Class MyClass<br />
    Implements IMyInterface<br />
    Friend Property Name() as String Implements IMyInterface.Name<br />
        Get<br />
        End Get<br />
        Set(value as String)<br />
        End Set<br />
    End Property<br />
End Class<br />


...this generates no errors.

Why is this? If VB.Net can do it, the CLR must allow it, so why can't C# do it?

Would it be because an internal class member defined in an interface doesn't make much sense from a design standpoint? In other words, an internal interface member kind of defeats the purpose of creating an interface in the first place. Is this just a well-thought-out constraint of C#?


- Mike

-------------------------
"No human being would stack books like that." - Dr. Venkman
GeneralRe: interface members as internal Pin
Heath Stewart17-May-04 8:03
protectorHeath Stewart17-May-04 8:03 
GeneralRe: interface members as internal Pin
Mike Hodnick17-May-04 9:26
Mike Hodnick17-May-04 9:26 
GeneralBitmap file Pin
Saleh Alshadheli17-May-04 6:45
Saleh Alshadheli17-May-04 6:45 
GeneralRe: Bitmap file Pin
Dave Kreskowiak17-May-04 6:55
mveDave Kreskowiak17-May-04 6:55 
GeneralRe: Bitmap file Pin
Heath Stewart17-May-04 7:21
protectorHeath Stewart17-May-04 7:21 
GeneralPotential Field Algorithms Pin
sodium17-May-04 6:45
sodium17-May-04 6:45 
GeneralRe: Potential Field Algorithms Pin
Dave Kreskowiak17-May-04 7:14
mveDave Kreskowiak17-May-04 7:14 
GeneralRe: Potential Field Algorithms Pin
sodium17-May-04 20:11
sodium17-May-04 20:11 
GeneralRe: Potential Field Algorithms Pin
Dave Kreskowiak18-May-04 0:08
mveDave Kreskowiak18-May-04 0:08 
GeneralConverting xsd to csv using xslt Pin
tunde17-May-04 6:44
tunde17-May-04 6:44 
GeneralRe: Converting xsd to csv using xslt Pin
Heath Stewart17-May-04 7:17
protectorHeath Stewart17-May-04 7:17 
GeneralRe: Converting xsd to csv using xslt Pin
tunde17-May-04 13:02
tunde17-May-04 13:02 
GeneralBitmaps Pin
Saleh Alshadheli17-May-04 6:30
Saleh Alshadheli17-May-04 6:30 
GeneralRe: Bitmaps Pin
Dave Kreskowiak17-May-04 6:40
mveDave Kreskowiak17-May-04 6:40 
QuestionWhy this default Directory? Pin
Adam °Wimsatt17-May-04 5:38
Adam °Wimsatt17-May-04 5:38 
AnswerRe: Why this default Directory? Pin
Heath Stewart17-May-04 5:57
protectorHeath Stewart17-May-04 5:57 
GeneralRe: Why this default Directory? Pin
Adam °Wimsatt17-May-04 6:04
Adam °Wimsatt17-May-04 6:04 

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.