C#泛型:为什么int []没有实现IList< int>? [英] C# Generics: Why int[] doesn't implement IList<int>?

查看:89
本文介绍了C#泛型:为什么int []没有实现IList< int>?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好


我刚刚获得VS 2005预览版,并且正在尝试仿制药。


我试过以下代码


int [] intArray = new int [100];

IList< int> intList =(IList< int>)intArray;


它没编译,以下也没编译


IEnumerable< ; INT> intEnumerable =(IEnumerable< int>)intArray;


恕我直言,int []应该实现IList< int>,

IEnumerable< int>等等,因为它实现了非通用的IList,并且

IEnumerable。


祝你好运,

Sherif

解决方案

请将whidbey问题发布到私人whidbey NG,这个NG用于

发布的产品。


Willy。


" Sherif ElMetainy" < EL ************* @ wayout.net.NOSPAM>在留言中写道

新闻:e9 ************** @ TK2MSFTNGP11.phx.gbl ...

你好

我刚刚获得VS 2005预览版,并且正在尝试使用泛型。

我尝试了以下代码

int [] intArray = new int [100];
IList< int> intList =(IList< int>)intArray;

它没有编译,以下也没有编译

IEnumerable< int> intEnumerable =(IEnumerable< int>)intArray;

恕我直言,int []应该实现IList< int>,
IEnumerable< int>等,因为它实现了非-generic IList,
IEnumerable。

致敬,谢谢你
请将whidbey问题发布到私人whidbey NG,这个NG用于

发布的产品。


Willy。


Sherif ElMetainy < EL ************* @ wayout.net.NOSPAM>在留言中写道

新闻:e9 ************** @ TK2MSFTNGP11.phx.gbl ...

你好

我刚刚获得VS 2005预览版,并且正在尝试使用泛型。

我尝试了以下代码

int [] intArray = new int [100];
IList< int> intList =(IList< int>)intArray;

它没有编译,以下也没有编译

IEnumerable< int> intEnumerable =(IEnumerable< int>)intArray;

恕我直言,int []应该实现IList< int>,
IEnumerable< int>等,因为它实现了非-generic IList,
IEnumerable。

致敬,谢谢你
Sherif,


鉴于System.Array实现IList和IEnumerable,应该绝对支持

专用版本。


我会提交一个错误。感谢您找到它。

-

- Nicholas Paldino [.NET / C#MVP]

- mv*@spam.guard.caspershouse.com


" Sherif ElMetainy" < EL ************* @ wayout.net.NOSPAM>在留言中写道

新闻:e9 ************** @ TK2MSFTNGP11.phx.gbl ...

你好

我刚刚获得VS 2005预览版,并且正在尝试使用泛型。

我尝试了以下代码

int [] intArray = new int [100];
IList< int> intList =(IList< int>)intArray;

它没有编译,以下也没有编译

IEnumerable< int> intEnumerable =(IEnumerable< int>)intArray;

恕我直言,int []应该实现IList< int>,
IEnumerable< int>等,因为它实现了非-generic IList,
IEnumerable。

致以诚挚的问候,
谢里夫



Hello

I was just got VS 2005 preview, and was trying generics.

I tried the following code

int[] intArray = new int[100];
IList<int> intList = (IList<int>) intArray;

it didn''t compile, also the following didn''t compile

IEnumerable<int> intEnumerable = (IEnumerable<int>)intArray;

IMHO it makes perfect sense that int[] should implement IList<int>,
IEnumerable<int>, etc, since it implements the non-generic IList, and
IEnumerable.

Best regards,
Sherif

解决方案

Please, post whidbey questions to the private whidbey NG, This NG is for
released products.

Willy.

"Sherif ElMetainy" <el*************@wayout.net.NOSPAM> wrote in message
news:e9**************@TK2MSFTNGP11.phx.gbl...

Hello

I was just got VS 2005 preview, and was trying generics.

I tried the following code

int[] intArray = new int[100];
IList<int> intList = (IList<int>) intArray;

it didn''t compile, also the following didn''t compile

IEnumerable<int> intEnumerable = (IEnumerable<int>)intArray;

IMHO it makes perfect sense that int[] should implement IList<int>,
IEnumerable<int>, etc, since it implements the non-generic IList, and
IEnumerable.

Best regards,
Sherif



Please, post whidbey questions to the private whidbey NG, This NG is for
released products.

Willy.

"Sherif ElMetainy" <el*************@wayout.net.NOSPAM> wrote in message
news:e9**************@TK2MSFTNGP11.phx.gbl...

Hello

I was just got VS 2005 preview, and was trying generics.

I tried the following code

int[] intArray = new int[100];
IList<int> intList = (IList<int>) intArray;

it didn''t compile, also the following didn''t compile

IEnumerable<int> intEnumerable = (IEnumerable<int>)intArray;

IMHO it makes perfect sense that int[] should implement IList<int>,
IEnumerable<int>, etc, since it implements the non-generic IList, and
IEnumerable.

Best regards,
Sherif



Sherif,

Given that System.Array implements IList and IEnumerable, the
specialized versions should definitely be supported.

I''ll file a bug. Thanks for finding it.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Sherif ElMetainy" <el*************@wayout.net.NOSPAM> wrote in message
news:e9**************@TK2MSFTNGP11.phx.gbl...

Hello

I was just got VS 2005 preview, and was trying generics.

I tried the following code

int[] intArray = new int[100];
IList<int> intList = (IList<int>) intArray;

it didn''t compile, also the following didn''t compile

IEnumerable<int> intEnumerable = (IEnumerable<int>)intArray;

IMHO it makes perfect sense that int[] should implement IList<int>,
IEnumerable<int>, etc, since it implements the non-generic IList, and
IEnumerable.

Best regards,
Sherif



这篇关于C#泛型:为什么int []没有实现IList&lt; int&gt;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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