Interface C#, 2.0

  • Thread starter Thread starter rh1200la
  • Start date Start date
R

rh1200la

Noob question here.


I'm creating an interface with various properties, but I also want it
to include a <list> of a particular object. What is the correct syntax
to do this in an interface? Thanks.
 
I'm creating an interface with various properties, but I also want it
to include a <list> of a particular object. What is the correct syntax
to do this in an interface?

An interface can only contain abstract methods and properties
not any implementation (and a field is implementation).

Arne
 
So I would just leave it until I create the specific class?

Or use an abstract base class instead of an interface.

Arne
 
Noob question here.


I'm creating an interface with various properties, but I also want it
to include a <list> of a particular object. What is the correct syntax
to do this in an interface? Thanks.

I'd advise you to write a property:

interface Foo
{
List<ParticularObject> MyList { get; }
}

-- Barry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top