T
Tamir Khason
Strange problem:
In C# compiler detects that some code in case constraint is unreacheble, BUT
it do not detect redefined variables which can not be executed together.
(BTW: in VB.NET - this works perfect !!! )
IDEAS?
See there:
public static IDataHelper GetDataHelper(DataHelperType helperType)
{
switch (helperType)
{
case DataHelperType.OleDB:
SQLDataHelper helper = new SQLDataHelper();
return helper;
//break; //Compiler detects that the code is unreachable!!!
case DataHelperType.SQLServer:
OleDBDataHelper helper = new OleDBDataHelper(); //Compiler return error " A
local variable named 'helper' is already defined in this scope"
return helper;
//break;
}
}
In C# compiler detects that some code in case constraint is unreacheble, BUT
it do not detect redefined variables which can not be executed together.
(BTW: in VB.NET - this works perfect !!! )
IDEAS?
See there:
public static IDataHelper GetDataHelper(DataHelperType helperType)
{
switch (helperType)
{
case DataHelperType.OleDB:
SQLDataHelper helper = new SQLDataHelper();
return helper;
//break; //Compiler detects that the code is unreachable!!!
case DataHelperType.SQLServer:
OleDBDataHelper helper = new OleDBDataHelper(); //Compiler return error " A
local variable named 'helper' is already defined in this scope"
return helper;
//break;
}
}