Z
Zoury
Hi there!
I'm Coming from a classic VB background. In VB *any* declaration in a given
scope are made when the given scope is "entered".
What about the following C# code snippet?
//***
private void MyFunc(string s)
{
if (s.Length == 0) {return;}
string s2 = "a string";
int i = 0;
// code code code...
}
//***
Would that prevent the variables from being declared if not necessary or is
it the same as :
//***
private void MyFunc(string s)
{
string s2 = "a string";
int i = 0;
if (s.Length == 0) {return;}
// code code code...
}
//***
What's the best pratice? and for those who knows... is VB.NET working the
same way as C#?
I'm Coming from a classic VB background. In VB *any* declaration in a given
scope are made when the given scope is "entered".
What about the following C# code snippet?
//***
private void MyFunc(string s)
{
if (s.Length == 0) {return;}
string s2 = "a string";
int i = 0;
// code code code...
}
//***
Would that prevent the variables from being declared if not necessary or is
it the same as :
//***
private void MyFunc(string s)
{
string s2 = "a string";
int i = 0;
if (s.Length == 0) {return;}
// code code code...
}
//***
What's the best pratice? and for those who knows... is VB.NET working the
same way as C#?