开发者

Default argument of generic type, instantiated to int is 'null' according to Intellisense

Out of curiosity, is the following a bug or intended behavior? It seems IMHO strange that the def开发者_高级运维ault argument of an integer parameter is null.

Default argument of generic type, instantiated to int is 'null' according to Intellisense


This could be your IDE displaying it improperly; if the code compiles properly, you might want to print the argument in that function, to ensure that you're getting the default value that you expect.

I would be willing to bet that it is functioning as intended.


On my computer, VS Professional 2010, targeting .Net 4.0, it has the correct information int arg = Default(T). So, I suppose you are not going crazy :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜