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

Popular posts from this blog

model view controller - MVC Rails Planning -

ruby on rails - Devise Logout Error in RoR -

html - Submenu setup with jquery and effect 'fold' -