I had a problem with the following declaration:
byte[] frameBuffer = new byte[VideoFile.FRAME_SIZE];
I had this declared as a variable in a class I created. Unfortunately, Visual Studio placed a squiggly yellow line under it and declared "FRAME_SIZE" as not existing in the current context. The squiggly yellow line is what bothers me. If I give it a completely non-existent name it uses a squiggly red line, but since FRAME_SIZE does it exist I get a yellow line.
FRAME_SIZE
is declared in the VideoFile
class as follows:
public static readonly int FRAME_SIZE = 2621440;
It works in other cases when I reference it, but just not in this particular case. I have tried experimenting with other declarations that do not give me the dreaded yellow squiggly:
First experiment:
const int NEW_FRAME_SIZE = 256;
byte[] frameBuffer2 = new byte[NEW_FRAME_SIZE];
Second experiment:
int thisworks = VideoFile.FRAME_SIZE;
I finally placed my original declaration within the class' constructor and it worked:
byte[] frameBuffer = new byte[VideoFile.FRAME_SIZE]; // placed in constructor
Researching this issue on yielded many results, but none which particularly answer my question:
The name 'controlname' does not exist in the current context
The name 'controlname' does not exist in the current context
The name XXXX does not exist in the current context
I think the issue relates to not being able to use this particular variable for initialization outside of the constructor, but I would like to get a definite answer along with a reference to where I can research this further.