Click here to Skip to main content
15,896,487 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: An interesting (or not) thing about C#'s var Pin
TheGreatAndPowerfulOz25-Oct-16 12:20
TheGreatAndPowerfulOz25-Oct-16 12:20 
GeneralRe: An interesting (or not) thing about C#'s var Pin
n.podbielski25-Oct-16 8:09
n.podbielski25-Oct-16 8:09 
GeneralRe: An interesting (or not) thing about C#'s var Pin
Marc Clifton25-Oct-16 8:21
mvaMarc Clifton25-Oct-16 8:21 
GeneralRe: An interesting (or not) thing about C#'s var Pin
n.podbielski25-Oct-16 8:35
n.podbielski25-Oct-16 8:35 
GeneralRe: An interesting (or not) thing about C#'s var Pin
Nish Nishant25-Oct-16 10:14
sitebuilderNish Nishant25-Oct-16 10:14 
GeneralRe: An interesting (or not) thing about C#'s var Pin
Mladen Janković25-Oct-16 10:20
Mladen Janković25-Oct-16 10:20 
GeneralRe: An interesting (or not) thing about C#'s var Pin
Mycroft Holmes25-Oct-16 14:17
professionalMycroft Holmes25-Oct-16 14:17 
GeneralRe: An interesting (or not) thing about C#'s var Pin
Richard Deeming26-Oct-16 3:50
mveRichard Deeming26-Oct-16 3:50 
Mycroft Holmes wrote:
var seem way too close to the VB6 variant type

A common misconception.

var doesn't mean that your variable is untyped, or typed as object. It just means that the compiler decides what type the variable should be based on the value assigned to it when it is declared.
C#
var s = "Hello"; // Compiles to exactly the same IL as "string s = ..."
s = 42; // Compiler error - cannot assign an Int32 to a String

Totally unlike the Variant type, where the variable could contain anything, and all calls were late-bound:
VB
Dim s As Variant
s = "Hello" ' Oh, it's a string...
s = 42 ' Now it's a Long - that's fine...
Set s = New ADODB.Connection ' An object? No problem...




"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


GeneralRe: An interesting (or not) thing about C#'s var Pin
#realJSOP26-Oct-16 0:06
professional#realJSOP26-Oct-16 0:06 
GeneralRe: An interesting (or not) thing about C#'s var Pin
Richard Deeming26-Oct-16 3:52
mveRichard Deeming26-Oct-16 3:52 
GeneralRe: An interesting (or not) thing about C#'s var Pin
Jeremy Falcon26-Oct-16 8:44
professionalJeremy Falcon26-Oct-16 8:44 
GeneralRe: An interesting (or not) thing about C#'s var Pin
Mladen Janković26-Oct-16 4:56
Mladen Janković26-Oct-16 4:56 
GeneralRe: An interesting (or not) thing about C#'s var Pin
Jeremy Falcon26-Oct-16 8:45
professionalJeremy Falcon26-Oct-16 8:45 
GeneralTopTal, Codility, and skill testing Pin
Marc Clifton25-Oct-16 5:16
mvaMarc Clifton25-Oct-16 5:16 
QuestionRe: TopTal, Codility, and skill testing Pin
ZurdoDev25-Oct-16 5:32
professionalZurdoDev25-Oct-16 5:32 
AnswerRe: TopTal, Codility, and skill testing Pin
Marc Clifton25-Oct-16 5:47
mvaMarc Clifton25-Oct-16 5:47 
AnswerRe: TopTal, Codility, and skill testing Pin
Gerry Schmitz26-Oct-16 4:52
mveGerry Schmitz26-Oct-16 4:52 
GeneralRe: TopTal, Codility, and skill testing Pin
Tim Carmichael25-Oct-16 5:55
Tim Carmichael25-Oct-16 5:55 
GeneralRe: TopTal, Codility, and skill testing Pin
Slacker00725-Oct-16 5:58
professionalSlacker00725-Oct-16 5:58 
GeneralRe: TopTal, Codility, and skill testing Pin
Marc Clifton25-Oct-16 7:14
mvaMarc Clifton25-Oct-16 7:14 
GeneralRe: TopTal, Codility, and skill testing Pin
F-ES Sitecore25-Oct-16 6:03
professionalF-ES Sitecore25-Oct-16 6:03 
GeneralRe: TopTal, Codility, and skill testing Pin
Marc Clifton25-Oct-16 7:17
mvaMarc Clifton25-Oct-16 7:17 
GeneralRe: TopTal, Codility, and skill testing Pin
Kevin Marois25-Oct-16 7:44
professionalKevin Marois25-Oct-16 7:44 
GeneralRe: TopTal, Codility, and skill testing Pin
Stephen Gonzalez25-Oct-16 8:08
Stephen Gonzalez25-Oct-16 8:08 
GeneralRe: TopTal, Codility, and skill testing Pin
Marc Clifton25-Oct-16 8:21
mvaMarc Clifton25-Oct-16 8:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.