Picking up C#, can’t seem to find any useful reference to this, other than examples.
So, what is Dim in C#?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In VB,
Dimdeclares a variable of a particular type (or of variable type, if you don’t specify one). If youDim x as Foo, that declares a variable of typeFoocalledx.In C#, the equivalent is to state the type followed by the variable’s name, as in:
You can also assign in the same step:
C# supports type inference, so you can also do:
A
Dimwithout a corresponding type in VB is similar to declaring a type asObjectin C#: