Click here to Skip to main content
15,885,032 members
Home / Discussions / C#
   

C#

 
GeneralRe: NumericString Sort Pin
harold aptroot12-Feb-14 22:39
harold aptroot12-Feb-14 22:39 
AnswerRe: NumericString Sort Pin
DaveyM6912-Feb-14 23:37
professionalDaveyM6912-Feb-14 23:37 
AnswerRe: NumericString Sort Pin
Richard Deeming13-Feb-14 0:50
mveRichard Deeming13-Feb-14 0:50 
QuestionHow to Serialize & De-Serialize Any Controls Property in C# Pin
Tridip Bhattacharjee12-Feb-14 20:26
professionalTridip Bhattacharjee12-Feb-14 20:26 
AnswerRe: How to Serialize & De-Serialize Any Controls Property in C# Pin
BillWoodruff12-Feb-14 22:57
professionalBillWoodruff12-Feb-14 22:57 
QuestionWhat is the difference between JavaScript 'var' and C# 'dynamic' Pin
Sanju Uthaiah Bollera12-Feb-14 20:08
Sanju Uthaiah Bollera12-Feb-14 20:08 
AnswerRe: What is the difference between JavaScript 'var' and C# 'dynamic' Pin
Richard MacCutchan12-Feb-14 21:41
mveRichard MacCutchan12-Feb-14 21:41 
AnswerRe: What is the difference between JavaScript 'var' and C# 'dynamic' Pin
BillWoodruff12-Feb-14 22:40
professionalBillWoodruff12-Feb-14 22:40 
First, in comparing JavaScript and C#: you are comparing "dogs" to "cats."

JavaScript is a loosely-typed language where all variables Types are determined at run-time; C# is a strongly-typed language where all variable Types must be known at compile-time.

With C# 4.0 came the implementation of the 'dynamic keyword which allows a functionality similar to JavaScript's 'var: determination of Type of a 'dynamic C# variable can be resolved at run-time. In computer science terms this is "late-binding."

So, you can do this in C#:
C#
dynamic v1 = "string";
v1 = 100;
v1 = new Dictionary<string, string>();
That's nonsense of course, but it illustrates the fact that the compiler will not throw an error, which indicates that a 'dynamic variable in C# can be used for "anything."

In JavaScript declaring a variable with 'var makes it a local variable. In C# 'var is short-hand for "the Type is inferred from the context," and is used to save duplicating Type declarations on the left-hand side of a variable declaration, and to hold the anonymous Types resulting from Linq operations, queries, etc.
“But I don't want to go among mad people,” Alice remarked.

“Oh, you can't help that,” said the Cat: “we're all mad here. I'm mad. You're mad.”

“How do you know I'm mad?” said Alice.

“You must be," said the Cat, or you wouldn't have come here.” Lewis Carroll

Questiondatagridview combobox Pin
abdul rafi12-Feb-14 19:29
abdul rafi12-Feb-14 19:29 
AnswerRe: datagridview combobox Pin
Eddy Vluggen13-Feb-14 9:06
professionalEddy Vluggen13-Feb-14 9:06 
Question3D Model Pin
Kadam dIgambar12-Feb-14 18:07
Kadam dIgambar12-Feb-14 18:07 
SuggestionRe: 3D Model Pin
Richard MacCutchan12-Feb-14 21:39
mveRichard MacCutchan12-Feb-14 21:39 
GeneralRe: 3D Model Pin
JV999914-Feb-14 3:07
professionalJV999914-Feb-14 3:07 
QuestionConverting Back from Decimal to Byte Pin
computerpublic12-Feb-14 10:03
computerpublic12-Feb-14 10:03 
AnswerRe: Converting Back from Decimal to Byte Pin
Richard Deeming12-Feb-14 11:07
mveRichard Deeming12-Feb-14 11:07 
GeneralRe: Converting Back from Decimal to Byte Pin
computerpublic12-Feb-14 11:29
computerpublic12-Feb-14 11:29 
GeneralRe: Converting Back from Decimal to Byte Pin
Richard Deeming13-Feb-14 0:37
mveRichard Deeming13-Feb-14 0:37 
GeneralRe: Converting Back from Decimal to Byte Pin
computerpublic13-Feb-14 9:15
computerpublic13-Feb-14 9:15 
GeneralRe: Converting Back from Decimal to Byte Pin
Richard Deeming13-Feb-14 10:35
mveRichard Deeming13-Feb-14 10:35 
GeneralRe: Converting Back from Decimal to Byte Pin
computerpublic13-Feb-14 10:48
computerpublic13-Feb-14 10:48 
GeneralRe: Converting Back from Decimal to Byte Pin
computerpublic16-Feb-14 6:00
computerpublic16-Feb-14 6:00 
GeneralRe: Converting Back from Decimal to Byte Pin
computerpublic16-Feb-14 6:03
computerpublic16-Feb-14 6:03 
GeneralRe: Converting Back from Decimal to Byte Pin
Richard Deeming17-Feb-14 1:46
mveRichard Deeming17-Feb-14 1:46 
GeneralRe: Converting Back from Decimal to Byte Pin
computerpublic18-Feb-14 22:51
computerpublic18-Feb-14 22:51 
GeneralRe: Converting Back from Decimal to Byte Pin
computerpublic18-Feb-14 23:03
computerpublic18-Feb-14 23:03 

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.