.NET中类型化数组的模板 [英] template for typed arrays in .NET

查看:72
本文介绍了.NET中类型化数组的模板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的,

目前我只发现有可能为每种类型创建它自己键入的

数组。我厌倦了为每个类型创建一个单独的数组类。

在C ++中有所谓的模板:template< T> class ...

是否可以在VB或c#中使用?你能举个例子吗?

谢谢,

Boni

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

推荐答案

你好,


VS.Net 2005将支持泛型。

http://msdn.microsoft.com/library/de...5_generics.asp




-------------------

" Boni" ; < oilia @ NOSPAM>写在消息

新闻:%2 **************** @ tk2msftngp13.phx.gbl ...

亲爱的,

目前我只发现有可能为每种类型创建它自己的类型

数组。我厌倦了为每个类型创建一个单独的数组类。

在C ++中有所谓的模板:template< T> class ...

是否可以在VB或c#中使用?你能举个例子吗?

谢谢,

Boni

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:
"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.




我没有看到任何创建数组类的原因。您可以使用VB.NET的数组语法简单地创建一个

类型数组:


\\\

Dim foo(9)As MyType

....

///


-

MS Herfried K. Wagner

MVP< URL:http://dotnet.mvps.org/>

VB< URL:http:// classicvb.org/petition/>



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/>


我创建它们用于输入ArrayList和Hashtable类,也许这就是

他是什么是什么意思?


" Herfried K. Wagner [MVP]" <喜*************** @ gmx.at>在消息中写道

news:e8 **************** @ TK2MSFTNGP12.phx.gbl ...
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:
"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.



我没有看到任何创建数组类的原因。您可以使用VB.NET的数组语法简单地创建一个类型化的数组:

\\\
Dim foo(9)As MyType
...
///

MS Herfried K. Wagner
MVP< URL:http://dotnet.mvps.org/>
VB< URL:http://classicvb.org/petition/>



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/>



这篇关于.NET中类型化数组的模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆