10
I use the IOC standard in my project which facilitates the call of procedure type Resolver.Resolve<IPedido>().GerarPedido()
, however, I did not want to leave "loose" in this way, I would like to implement the method IDisposable
wear like this:
using (var pedido = Resolver.Resolve<IPedido>())
{
pedido.GerarPedido();
}
- I can implement
IDisposable
in a simple class, in this example,Pedido
? It would be good practice? - Has processing cost?
- How best to implement
IDisposable
in this example?
For a class to have to implement Idisposable there has to be a reason, in your case what is?
– ramaral
Well, in my mind, I wanted to
matar
Resolver.Resolve<IPedido>().GerarPedido()
soon after its execution. The classPedido
is a basic class, does not use any external component.– rubStackOverflow
@rubStackOverflow What "kill" the request means?
– dcastro
Remove from memory :) @dcastro
– rubStackOverflow