Hey,
I noticed that I have been using var instead of string, int etc. in delegates due to a habit from another language where they were cleared after, and it just makes a temporary value for the class only, and once it has executed, is deleted.
Is this the same in C#, or can I just use string or int etc?
Which is better?
Thanks.
bbman 12
Junior Poster
Recommended Answers
Jump to PostThere are arguments that go on forever and a day about when to use var...
Var can be used to signify any object but it will keep that object type once something has been assigned to it, until it falls out of scope.
There isn't a problem with …
All 2 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.