J
Juan Zamudio
Hi all, I'm using vs 2003, i have a question about using and as, i was
reading in programing .net components that one way to avoid null
references inside using was using as, something like this:
using(var as IDisposable){
.....
}
the book saids that if the conversion is null the code inside using will
not run, but i cant make it work, I have a FileStream that opens a file,
the path is a parameter, something like this:
using((fileStream=new FileStream((fullPath,FileMode.Open,
FileAccess.Read,FileShare.Read)) as IDisposable){
.....
}
But if the path points to a non existing file the code inside the using
throws an exception, the only way to avoid this is to check for null
before using???, thanks a lot.
Juan Zamudio
reading in programing .net components that one way to avoid null
references inside using was using as, something like this:
using(var as IDisposable){
.....
}
the book saids that if the conversion is null the code inside using will
not run, but i cant make it work, I have a FileStream that opens a file,
the path is a parameter, something like this:
using((fileStream=new FileStream((fullPath,FileMode.Open,
FileAccess.Read,FileShare.Read)) as IDisposable){
.....
}
But if the path points to a non existing file the code inside the using
throws an exception, the only way to avoid this is to check for null
before using???, thanks a lot.
Juan Zamudio