goose007


Ok this didn't seem to work.

Code Snippet

'''

''' Defines a mechanism for saving, loading, and access to properties of a SQL contact row.

'''

'''

Interface IContact

Inherits ISQLRow, IAddress

Property FirstName() As String

Property LastName() As String

Property MiddleInitial() As String

Property JobTitle() As String

Property DefaultEmail() As Integer

Property DefaultPhone() As Integer

Property Emails() As GenericCollection(Of IEmail) <--------------------

Property Phones() As GenericCollection(Of IPhone) <--------------------

End Interface

I have been in Iraq for 2 years and have been away from the programming world for awhile.... Trying to get back into the swing of things...I was using vb6 before I left and am a bit rusty. I am using VS 2005 now. So should I make this a collection of the class -v-v-v-v-v-v-v-

Code Snippet
Property Emails() As GenericCollection(Of Email)

or is there a way to include the Interface as well (aside from the class email)

If at all possible if someone could point me to some literature,videos, etc.. for learning interface and .Net. I am wanting to brush up on my OO skills. I purchased a GoF book, but it seems more like a cheat sheet then a learning tool.

P.S. only been researchig the .Net Framework for about 2-3 months so please correct me if I am totally missing something!

Thanks,

GOOSE007



Re: Interface - Collection of Interfaces?

OmegaDan


Article on Interface:

http://www.developer.com/lang/other/article.php/939411

other good VB.net sites:

http://www.developerfusion.co.uk/vbnet/
http://www.vbdotnetheaven.com/




Re: Interface - Collection of Interfaces?

goose007

I already know how to "use" an Interface. But unsure how to "form" an interface containing a collection of Interfaces!






Re: Interface - Collection of Interfaces?

goose007

I found the answer......

Code Snippet

Interface IContact

Inherits ISQL, IAddress

Property FirstName() As String

Property LastName() As String

Property MiddleInitial() As String

Property JobTitle() As String

Property DefaultEmail() As Integer

Property DefaultPhone() As Integer

Property Emails() As GenericCollection(Of IEmail)

Property Phones() As GenericCollection(Of IPhone)

End Interface

And then make sure you declare the Property as Friend or any other project only access

Code Snippet

Friend Property Emails() As GenericCollection(Of IEmail) Implements IContact.Emails

Get

Return _Emails

End Get

Set(ByVal value As GenericCollection(Of IEmail))

_Emails = value

End Set

End Property

*GenericCollection is a CollectionBase derived Collection (which also has an interface)

I can now add Interfaces to a collection and pull them out, nearly effortless

What are the potential limitations/problems of this I haven't run across anything yet, but would like to know what could possibly happen. As long as I can still use the interface down the road should I decide to change something!

Am I getting Interface happy