超过1个索引器 [英] more than 1 indexer

查看:76
本文介绍了超过1个索引器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

是否可以在一个班级中拥有多个索引器。如果没有,那么

有任何好的替代方法来实现类似的功能。


谢谢...


-Nikhil

解决方案

" Nikhil Patel" < NI ******** @ aol.com>在消息中写道

新闻:#L ************* @ TK2MSFTNGP11.phx.gbl ...

是否有可能拥有一个类中不止一个索引器。


只要他们各自使用不同的

数据类型,您就可以拥有多个索引器。

如果没有,是否有任何好的替代方法来实现类似的功能。




创建它作为一个函数? :-)


-

Michael Culley




Michael Culley < MC ***** @ NOSPAMoptushome.com.au>在消息中写道

新闻:Oo ************** @ TK2MSFTNGP12.phx.gbl ...

< blockquote class =post_quotes>如果没有,是否有任何好的替代方法来实现类似功能。



创建它作为一个函数? : - )




Michael,

我知道我可以创建一个函数。但是为了让你的生活更轻松,他们会在C#中提供索引器。所以我想知道如果我不能创建多个

索引器,是否还有其他东西可以用来实现相同的功能。因为我正在学习C#而不是专家。无论如何,感谢您花时间回答我的问题。


-Nikhil


您好Nikhil,

我想Michael给了你一个明确的答案:

Michael写道:

"你可以拥有任意数量的索引器只要他们各自获得一个

不同的

数据类型。

看起来你想拥有多个索引器,所有这些都是拥有

相同的原型。

假设您可以拥有多个索引器,它们都具有相同的原型。你怎么去

来区分它们?


如果你给我们更多关于你的信息,我们可能会帮你更多

意图。


B \ rgds

$

-----原始消息-----

来自:Nikhil Patel < ni ******** @ aol.com>

新闻组:microsoft.public.dotnet.languages.csharp

发送时间:7月23日星期三, 2003年2:16 PM

主题:回复:超过1个索引器


Michael Culley < MC ***** @ NOSPAMoptushome.com.au>在消息中写道
新闻:Oo ************** @ TK2MSFTNGP12.phx.gbl ...

如果没有,是否有任何好的替代方法来实现类似的功能。
创建它作为一个功能? : - )



Michael,
我知道我可以创建一个函数。但为了让您的生活更轻松,他们在C#中提供索引器。所以我想知道是否有其他东西



,如果我不能创建多个索引器,我可以使用它来实现相同的功能。因为我正在学习C#而不是专家。无论如何,感谢您抽出时间回答我的问题。

-Nikhil



Hi all,
Is it possible to have more than one indexer in a class. If not, are
there any good alternative ways to achieve similar functionality.

Thanks...

-Nikhil

解决方案

"Nikhil Patel" <ni********@aol.com> wrote in message
news:#L*************@TK2MSFTNGP11.phx.gbl...

Is it possible to have more than one indexer in a class.
You can as many indexers as you want as long as they each take a different
data type.
If not, are
there any good alternative ways to achieve similar functionality.



Create it as a function? :-)

--
Michael Culley



"Michael Culley" <mc*****@NOSPAMoptushome.com.au> wrote in message
news:Oo**************@TK2MSFTNGP12.phx.gbl...

If not, are
there any good alternative ways to achieve similar functionality.



Create it as a function? :-)



Michael,
I know I could create a function. But to make your life easier they
provide indexers in C#. So I wanted to know if there is something else that
I can use to achieve same functionality if I cannot create more than one
indexer. Because I am learning C# not an expert. Anyway, thanks for taking
your time and answering my questions.

-Nikhil


Hi Nikhil,
I think Michael gave you a clear answer:
Michael wrote:
"You can have as many indexers as you want as long as they each take a
different
data type."
It looks like you want to have more then one indexer, which all have the
same prototype.
Let say that you can have more then one indexer, which all have the same
prototype. How are you going to
distinguish them?

We might be able to help you more if you give us more information about your
intentions.

B\rgds
100
----- Original Message -----
From: "Nikhil Patel" <ni********@aol.com>
Newsgroups: microsoft.public.dotnet.languages.csharp
Sent: Wednesday, July 23, 2003 2:16 PM
Subject: Re: more than 1 indexer


"Michael Culley" <mc*****@NOSPAMoptushome.com.au> wrote in message
news:Oo**************@TK2MSFTNGP12.phx.gbl...

If not, are
there any good alternative ways to achieve similar functionality.
Create it as a function? :-)



Michael,
I know I could create a function. But to make your life easier they
provide indexers in C#. So I wanted to know if there is something else


that I can use to achieve same functionality if I cannot create more than one
indexer. Because I am learning C# not an expert. Anyway, thanks for taking
your time and answering my questions.

-Nikhil



这篇关于超过1个索引器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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