Ryan,
When you create an array of reference types, it only creates space for
the references. By default, references are set to null. To fix this, you
have to create an instance and assign it to the array, like this:
watcher[0] = new FileSystemWatcher();
This will create an instance of the file system watcher and place the
reference into the array.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"Ryan Rogers" <ry*********@tesma.com> wrote in message
news:ea*************@TK2MSFTNGP11.phx.gbl...
I'm trying to create a FileSystemWatcher Array, however I am new at C#...
I know its not instanciating form somereason or not getting the reference
because I'm getting the
System.NullReferenceException and Here is bascially what I have for my
code:
FileSystemWatcher[] watcher = new FileSystemWatcher[2];
watcher[0].Path = "\\\\pumptest-a\\pats\\results";
This throws the exception