Specify a property in an Interface? 
Author Message
 Specify a property in an Interface?

Hi group,

Is it possible to specify a property in an Interface so that anyone who
implements that interface has to define a SET and GET for those properties?

With kind regards,

Steven Spits

- - -



Mon, 13 Dec 2004 22:45:43 GMT  
 Specify a property in an Interface?
Steven,

    Absolutely, you mean something like this?

public interface IMyInterface
{
    void SomeMethod();

    string MyProperty
    { get; set; }

    string MyProperty2
    {get;}

    string MyProperty3
    {set;}

Quote:
}

    The first property is readable/writable.  The second is read-only, and
the third is write-only.

    Hope this helps.

--
               - Nicholas Paldino [.NET MVP]


Quote:
> Hi group,

> Is it possible to specify a property in an Interface so that anyone who
> implements that interface has to define a SET and GET for those
properties?

> With kind regards,

> Steven Spits

> - - -



Mon, 13 Dec 2004 22:49:37 GMT  
 Specify a property in an Interface?
Yep, that's it, thanks...



Quote:
> Steven,

>     Absolutely, you mean something like this?

> public interface IMyInterface
> {
>     void SomeMethod();

>     string MyProperty
>     { get; set; }

>     string MyProperty2
>     {get;}

>     string MyProperty3
>     {set;}
> }

>     The first property is readable/writable.  The second is read-only, and
> the third is write-only.

>     Hope this helps.

> --
>                - Nicholas Paldino [.NET MVP]



> > Hi group,

> > Is it possible to specify a property in an Interface so that anyone who
> > implements that interface has to define a SET and GET for those
> properties?

> > With kind regards,

> > Steven Spits

> > - - -



Mon, 13 Dec 2004 23:20:44 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Specifying Property Defaults in a WSDL

2. Specifying a property sheet as part of the MDI main window

3. Specifying Property Info via XML

4. Creating a property on an Interface ?

5. Can not find property & method of interface

6. Ref counting an interface property

7. Enumerating methods/properties on an interface

8. Interface property

9. Problem inheriting a property from an interface.

10. Interface as Property (for use in VB) Problem

11. query COM interface property in debugger

12. #import and interface pointers as properties

 

 
Powered by phpBB® Forum Software