Var关键词的主要用途是什么?这个目的是什么? [英] What is main use of Var key word and what is that purpose?

查看:99
本文介绍了Var关键词的主要用途是什么?这个目的是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了一个来自CTS的问题,即



假设



int i = 10;

int j = 20;



然后var s = iz;



如果我们可以做到这样的话会发生什么呢?



他们的主要关注点是var关键词是什么?

I have faced one question from CTS ie

suppose

int i=10;
int j=20;

then var s= i.z;

what happens if we can do like this and what is the output of that?

their main concern is what is the var key word does?

推荐答案

请参阅 http://msdn.microsoft.com/en- us / library / bb383973.aspx [ ^ ]


直到 run 编译时才知道某个类型 - 就像Linq的匿名类型一样。
It's for when a type isn't known until run compile time -- as with Linq's anonymous types.


这篇关于Var关键词的主要用途是什么?这个目的是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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