c# - How is "using" statement supposed to work? -
I am trying to take advantage of the statement using Although it does not compile. Why? - does not match - for those objects that implement it so that they can block the code Automatically resolved at the end of: if any This interface of your classes implements the interface (or whatever it happens), you can use the syntax above to call the Basically it will be like the following: The only difference here is that in the first scenario, using the in the following code:
Uri Uri = new Uri ("http: // localhost: 50222 / odta"); Var Container = New Course System. Container (Yuri); CourseServiceRef.NotNeededededededTempUser = New coursecaref.noted () {email = model. Username, Username 1 = Model User name}; Container.AddToNotNeededs (newTempUser); Container.SaveChanges ();
using
(var toto = new MyDisposableClass ()) {// do stuff}
disposable () method. You can use this int Can not use the
use blocks for objects that do not apply the ruffs, it will not be compiled simply.
var toto = New MyDisposableClass (try) {// do stuff} Finally (if (toto! = Null) (( IDisposable) toto) Dissociate ();}
toto scope of
using The end of the block dies.
Comments
Post a Comment