开发者

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

开发者 https://www.devze.com 2023-03-24 12:27 出处:网络
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.

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

精彩评论

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