c# - Using a variable in a function -
c# - Using a variable in a function -
i utilize dll , haven't source code. advised me utilize fonction of dll :
void idscallback.received(networkstream a) { using (a) { // code... } } i don't understand purpose of using. @ end of function, a.dispose() called a no longer usable.
so function called idscallback.received() can't utilize anymore.
why using in function idscallback.received() , not in function called idscallback.received() ?
it's similar javas auto resource closing try-catch. take @ documentation
in context should not dispose parameters. should rather create it:
void idscallback.received(networkstream a) { //.. } and create it:
using (networkstream = /* create stream */) { idscallback.received(a); // whatever else want } c# variables using
Comments
Post a Comment