126k views
3 votes
List the rules to keep in mind as you declare a variable in VB.NET

User Vtolentino
by
5.6k points

1 Answer

1 vote
- What is your variable scope? Ie., in what parts of the program do you need it?
- Is it a value type or a reference type. Reference types must always be "newed". Value types are more expensive to pass as parameters.
- Does the type implement IDisposable? Then you should use it in a using { } clause.
- Is the type immutable (like string or DateTime)? Then making changes to it is more expensive than you may think.
User Jason Boerner
by
5.8k points