Dear all,
currently I only found a possibility to create for each type it's own typed
array. I am sick to create for each of my types a separate array class.
In C++ there are so called templates: template<T > class...
Is it possible in VB or c#? Can you give me an example?
Thanks,
Boni 11 1758
Hi,
VS.Net 2005 will support generics. http://msdn.microsoft.com/library/de...5_generics.asp
Ken
-------------------
"Boni" <oilia@nospam> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Dear all,
currently I only found a possibility to create for each type it's own typed
array. I am sick to create for each of my types a separate array class.
In C++ there are so called templates: template<T > class...
Is it possible in VB or c#? Can you give me an example?
Thanks,
Boni
"Boni" <oilia@nospam> schrieb: currently I only found a possibility to create for each type it's own typed array. I am sick to create for each of my types a separate array class.
I don't see any reason for creating array classes. You can simply create a
typed array using VB.NET's array syntax:
\\\
Dim foo(9) As MyType
....
///
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
I create them for typing ArrayList and Hashtable classes, perhaps this is
what he means?
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:e8****************@TK2MSFTNGP12.phx.gbl... "Boni" <oilia@nospam> schrieb: currently I only found a possibility to create for each type it's own typed array. I am sick to create for each of my types a separate array class.
I don't see any reason for creating array classes. You can simply create a typed array using VB.NET's array syntax:
\\\ Dim foo(9) As MyType ... ///
-- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/>
What should I do If I nees an arraylist of unknown size or other collection? I don't see any reason for creating array classes. You can simply create a typed array using VB.NET's array syntax:
What should I do If I nees an arraylist of unknown size or other collection
type?
If you want to more strongy type an arraylist, derive a new class from
collectionbase and override some of the base class methods.
"Boni" <oilia@nospam> wrote in message
news:uP**************@TK2MSFTNGP09.phx.gbl... What should I do If I nees an arraylist of unknown size or other collection? I don't see any reason for creating array classes. You can simply create a typed array using VB.NET's array syntax:
What should I do If I nees an arraylist of unknown size or other collection type?
Boni wrote: What should I do If I nees an arraylist of unknown size or other collection type?
I think you're really talking about collection classes, aren't you? In
..NET 1, the usual way is to derive those from CollectionBase to create
collections that are typed by providing methods that have typed
signatures. In .NET 2, Generics provide typed collection classes like
List<T> out of the box, and there's PowerCollections
( http://www.wintellect.com/powercollections/) if you need additional
specialised collection implementations.
Oliver Sturm
--
omnibus ex nihilo ducendis sufficit unum
Spaces inserted to prevent google email destruction:
MSN oliver @ sturmnet.org Jabber sturm @ amessage.de
ICQ 27142619 http://www.sturmnet.org/blog
Hi,
You could do
foreach( MyType t in arraylist )
{}
you will get an exception if any of the elements of arraylist is not of
castable to MyType
cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Boni" <oilia@nospam> wrote in message
news:uP**************@TK2MSFTNGP09.phx.gbl... What should I do If I nees an arraylist of unknown size or other collection? I don't see any reason for creating array classes. You can simply create a typed array using VB.NET's array syntax:
What should I do If I nees an arraylist of unknown size or other collection type?
Yes I am. 2005 and .NET 2 are still in Beta so I can't use them in a
production environment. However, with generics this question will become
obsolete as you will be able to write something like Dim x as New
ArrayList<myClass>, I assume (I haven't looked into it yet).
"Oliver Sturm" <ol****@sturmnet.org> wrote in message
news:eN**************@TK2MSFTNGP10.phx.gbl... Boni wrote:
What should I do If I nees an arraylist of unknown size or other collection type?
I think you're really talking about collection classes, aren't you? In .NET 1, the usual way is to derive those from CollectionBase to create collections that are typed by providing methods that have typed signatures. In .NET 2, Generics provide typed collection classes like List<T> out of the box, and there's PowerCollections (http://www.wintellect.com/powercollections/) if you need additional specialised collection implementations.
Oliver Sturm -- omnibus ex nihilo ducendis sufficit unum Spaces inserted to prevent google email destruction: MSN oliver @ sturmnet.org Jabber sturm @ amessage.de ICQ 27142619 http://www.sturmnet.org/blog
Get the Visual Studio 2005 Beta 2 and do something like this:
C#:
List<MyType> myList = new List<MyType>();
Now you can use the strictly typed List<> object to Add(), Insert() and
traverse a list of MyType objects.
The VS 2005 Beta 2 does, indeed, rock!
--
// Anders Tornblad, Systems Developer at Visma Spcs, Sweden
"Boni" wrote: Dear all, currently I only found a possibility to create for each type it's own typed array. I am sick to create for each of my types a separate array class. In C++ there are so called templates: template<T > class... Is it possible in VB or c#? Can you give me an example? Thanks, Boni
"Robin Tucker" <id*************************@reallyidont.com> schrieb: I create them for typing ArrayList and Hashtable classes, perhaps this is what he means?
I don't consider arraylists and hashtables to be arrays...
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
"Anders Tornblad, SPCS, Sweden" <anders dot tornblad at telia dot com
nospamplease> schrieb: Get the Visual Studio 2005 Beta 2 and do something like this:
C#:
List<MyType> myList = new List<MyType>();
Now you can use the strictly typed List<> object to Add(), Insert() and traverse a list of MyType objects.
In VB 2005:
\\\
Dim MyList As New List(Of MyType)
///
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Jacek Dziedzic |
last post by:
Hello!
I have a templated class that serves as a simple vector of
elements.
template <typename T>
class simple_vector : public math_object {
// ... lots of simple_vector operations
// the...
|
by: Canonical Latin |
last post by:
"Leor Zolman" <leor@bdsoft.com> wrote
> "Canonical Latin" <javaplus@hotmail.com> wrote:
>
> > ...
> >But I'm still curious as to the rational of having type
>...
|
by: Boni |
last post by:
Dear all,
currently I only found a possibility to create for each type it's own typed
array. I am sick to create for each of my types a separate array class.
In C++ there are so called templates:...
|
by: Steven T. Hatton |
last post by:
Perhaps I'm just a bit frustrated, and I will soon realize the clear truth
of the matter, but right now I have some serious misgivings about the value
of investing a lot of time and effort into...
|
by: mike b |
last post by:
Hello everyone, thanks in advance for your help. I'm new to C++
templates and have run into some issues using member function
templates. I have a shared library containing templates that I'm...
|
by: nooneinparticular314159 |
last post by:
Hello. If I declare the following:
template<int a, int b, int SomeArray>
class DoSomething{
public:
..
..
..
|
by: Peng Yu |
last post by:
Hi,
Expression template can be used for the implementation of simple
operators without using temporaries (e.g. the ones in the book C++
Template).
I'm wondering whether expression template is...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |