PC Review


Reply
Thread Tools Rate Thread

Collection of classes

 
 
Nikolay Petrov
Guest
Posts: n/a
 
      11th Mar 2005
When create an array of type some class I can access the class method this
way:

Dim AccClass(1234) as SampleClass
arrClass(i).ClassMethod

Is the same possible with ArrayList or other type of Collection?

Thanks in advance


 
Reply With Quote
 
 
 
 
alejandro lapeyre
Guest
Posts: n/a
 
      11th Mar 2005
well, you can do this

CType(myList(i), SampleClass).ClassMethod

or at least define:

Function SampleClassItem(index as integer) as SampleClass
return CType(myList(index), SampleClass)
End Function

and then you can use:

SampleClassItem(i).ClassMethod

Best Regards,
Alejandro Lapeyre


"Nikolay Petrov" <johntup2_nospam_@mail.bg> escribió en el mensaje
news:%(E-Mail Removed)...
When create an array of type some class I can access the class method this
way:

Dim AccClass(1234) as SampleClass
arrClass(i).ClassMethod

Is the same possible with ArrayList or other type of Collection?

Thanks in advance



 
Reply With Quote
 
Nikolay Petrov
Guest
Posts: n/a
 
      11th Mar 2005
Any drawbacks of using - CType(myList(i), SampleClass).ClassMethod ?



"alejandro lapeyre" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> well, you can do this
>
> CType(myList(i), SampleClass).ClassMethod
>
> or at least define:
>
> Function SampleClassItem(index as integer) as SampleClass
> return CType(myList(index), SampleClass)
> End Function
>
> and then you can use:
>
> SampleClassItem(i).ClassMethod
>
> Best Regards,
> Alejandro Lapeyre
>
>
> "Nikolay Petrov" <johntup2_nospam_@mail.bg> escribió en el mensaje
> news:%(E-Mail Removed)...
> When create an array of type some class I can access the class method this
> way:
>
> Dim AccClass(1234) as SampleClass
> arrClass(i).ClassMethod
>
> Is the same possible with ArrayList or other type of Collection?
>
> Thanks in advance
>
>
>



 
Reply With Quote
 
=?Utf-8?B?RGVubmlz?=
Guest
Posts: n/a
 
      12th Mar 2005
I would use DirectCast instead of CType. I believe it's somewhat faster.

"Nikolay Petrov" wrote:

> Any drawbacks of using - CType(myList(i), SampleClass).ClassMethod ?
>
>
>
> "alejandro lapeyre" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
> > well, you can do this
> >
> > CType(myList(i), SampleClass).ClassMethod
> >
> > or at least define:
> >
> > Function SampleClassItem(index as integer) as SampleClass
> > return CType(myList(index), SampleClass)
> > End Function
> >
> > and then you can use:
> >
> > SampleClassItem(i).ClassMethod
> >
> > Best Regards,
> > Alejandro Lapeyre
> >
> >
> > "Nikolay Petrov" <johntup2_nospam_@mail.bg> escribió en el mensaje
> > news:%(E-Mail Removed)...
> > When create an array of type some class I can access the class method this
> > way:
> >
> > Dim AccClass(1234) as SampleClass
> > arrClass(i).ClassMethod
> >
> > Is the same possible with ArrayList or other type of Collection?
> >
> > Thanks in advance
> >
> >
> >

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
collection classes Mike P Microsoft C# .NET 8 20th Mar 2007 06:47 PM
Q: Collection Classes =?Utf-8?B?UmljaGFyZCBK?= Microsoft Dot NET 1 6th Feb 2007 10:49 PM
Collection classes =?Utf-8?B?Um95?= Microsoft Dot NET Framework 1 14th Dec 2005 07:06 PM
Third party collection classes Sam Marrocco Microsoft VB .NET 1 2nd Jan 2004 08:23 AM
Collection Classes Kevin Phifer Microsoft Dot NET 2 18th Nov 2003 05:57 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:49 PM.