Click here to Skip to main content
15,887,027 members
Home / Discussions / C#
   

C#

 
GeneralRe: what to use instead of 'var' in vs 2005 as for the projects developed in vs2005. Pin
Ennis Ray Lynch, Jr.20-Jul-09 8:02
Ennis Ray Lynch, Jr.20-Jul-09 8:02 
GeneralRe: what to use instead of 'var' in vs 2005 as for the projects developed in vs2005. Pin
Luc Pattyn20-Jul-09 8:06
sitebuilderLuc Pattyn20-Jul-09 8:06 
GeneralRe: what to use instead of 'var' in vs 2005 as for the projects developed in vs2005. Pin
PIEBALDconsult20-Jul-09 8:43
mvePIEBALDconsult20-Jul-09 8:43 
GeneralRe: what to use instead of 'var' in vs 2005 as for the projects developed in vs2005. Pin
Ian Shlasko20-Jul-09 10:23
Ian Shlasko20-Jul-09 10:23 
GeneralRe: what to use instead of 'var' in vs 2005 as for the projects developed in vs2005. Pin
PIEBALDconsult20-Jul-09 10:53
mvePIEBALDconsult20-Jul-09 10:53 
GeneralRe: what to use instead of 'var' in vs 2005 as for the projects developed in vs2005. Pin
Ian Shlasko20-Jul-09 11:23
Ian Shlasko20-Jul-09 11:23 
GeneralRe: what to use instead of 'var' in vs 2005 as for the projects developed in vs2005. Pin
PIEBALDconsult20-Jul-09 12:03
mvePIEBALDconsult20-Jul-09 12:03 
GeneralRe: what to use instead of 'var' in vs 2005 as for the projects developed in vs2005. Pin
S. Senthil Kumar20-Jul-09 19:28
S. Senthil Kumar20-Jul-09 19:28 
PIEBALDconsult wrote:
it is only to be used when you can't know the type;


Not trying to start an argument here, just curious. Would you say all dynamic languages are hard to read and are only for lazy programmers?

Python, which many people proclaim as the language easiest to read and understand, doesn't let you specify types for variables. There is no keyword equivalent to var even.

Also, I'd think var is useful when you don't care about the actual type, only that it has certain methods or properties.

var result = CalculateSomething();
result.DoX();


The code expresses the intent that it doesn't care what type result is, as long as there is a DoX method on it (without which it won't compile, of course). In a way, it's almost like result is a generic or template parameter.

What do you think?

Regards
Senthil
_____________________________
My Home Page |My Blog | My Articles | My Flickr | WinMacro

GeneralRe: what to use instead of 'var' in vs 2005 as for the projects developed in vs2005. Pin
PIEBALDconsult20-Jul-09 19:32
mvePIEBALDconsult20-Jul-09 19:32 
GeneralRe: what to use instead of 'var' in vs 2005 as for the projects developed in vs2005. Pin
N a v a n e e t h20-Jul-09 15:35
N a v a n e e t h20-Jul-09 15:35 
Questionscan using Twain in c#.net Pin
balu1234520-Jul-09 4:09
balu1234520-Jul-09 4:09 
AnswerRe: scan using Twain in c#.net Pin
DaveyM6920-Jul-09 4:17
professionalDaveyM6920-Jul-09 4:17 
AnswerRe: scan using Twain in c#.net Pin
DaveyM6920-Jul-09 4:31
professionalDaveyM6920-Jul-09 4:31 
GeneralRe: scan using Twain in c#.net Pin
Luc Pattyn20-Jul-09 4:50
sitebuilderLuc Pattyn20-Jul-09 4:50 
GeneralRe: scan using Twain in c#.net Pin
DaveyM6920-Jul-09 5:18
professionalDaveyM6920-Jul-09 5:18 
Questionread a excel and show it in datagrid c# Pin
Bird3720-Jul-09 4:07
Bird3720-Jul-09 4:07 
AnswerRe: read a excel and show it in datagrid c# Pin
Adam R Harris20-Jul-09 5:53
Adam R Harris20-Jul-09 5:53 
GeneralRe: read a excel and show it in datagrid c# Pin
Wendelldh21-Jul-09 3:52
Wendelldh21-Jul-09 3:52 
GeneralRe: read a excel and show it in datagrid c# Pin
Adam R Harris21-Jul-09 6:20
Adam R Harris21-Jul-09 6:20 
QuestionLPR failed after 10 jobs Pin
balu1234520-Jul-09 4:06
balu1234520-Jul-09 4:06 
QuestionFramework Version - using 2.0 instead of 3.5 Pin
chrisx5120-Jul-09 3:43
chrisx5120-Jul-09 3:43 
AnswerRe: Framework Version - using 2.0 instead of 3.5 Pin
jo H20-Jul-09 4:52
jo H20-Jul-09 4:52 
GeneralRe: Framework Version - using 2.0 instead of 3.5 Pin
chrisx5120-Jul-09 4:59
chrisx5120-Jul-09 4:59 
GeneralRe: Framework Version - using 2.0 instead of 3.5 Pin
mypicturefaded20-Jul-09 5:03
mypicturefaded20-Jul-09 5:03 
GeneralRe: Framework Version - using 2.0 instead of 3.5 Pin
chrisx5120-Jul-09 5:27
chrisx5120-Jul-09 5:27 

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.