Why should I use var instead of a type? [duplicate]
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: ReSharper and var After I have installed ReSharper it demands(by warnings) that I use var whenever possible, for example UnhandledExceptionEventArgs ue = (UnhandledExceptionEventArgs) t; ReSharper wants to turn it into var ue = (UnhandledExceptionEventArgs) t; I like the first version better, is there any reason to prefer var ? better performance? anything? or is it just a code style? 回答1: It's really just a