I'm using Visual C# Express 2010, on Windows XP SP3.
I took pain to define the var collBlock in the class directly, however, when I try to use it, it works once and then NOT.
Google searched all and tried a lot of solution. Error stil comes up.
The code below is partial, don't count the '{}', they are correct (VS2010 autocorrect won't allow even the most indifferent mistyping)
public class DMSecDoc
{
//...some declares...
//
private Hashtable collBlock = new Hashtable();
// this works...
private int ReadAllBlocks(BinaryReader aReader, Int32 nNumOfBlock)
{
collBlock.Clear();
try
{
for (int i = 0; i < nNumOfBlock; i++)
{
aBlock = new DataBlock();
aBlock.Init(aReader);
collBlock.Add(aBlock.GetName(), aBlock);
}
return 0;
}
catch
{
return 99;
}
}
// this one does not. What gives ? =============
private string[] GetThatDataBlock(String name)
{
String[] arrData = null;
//The name 'collBlock' does not exist in the current context
DataBlock aBlock = (DataBlock)collBlock(name);
arrData = aBlock.GetData();
return arrData;
}