Questions tagged as 'dispose'

2
answers

When is it advisable for a class to implement IDisposable?

I use the IOC standard in my project which facilitates the procedure call of type Resolver.Resolve<IPedido>().GerarPedido() , but I did not want to leave it "loose" in this way, I would like to implement the method IDisposable...
asked by 15.11.2015 / 18:27
2
answers

When should I use GC.SuppressFinalize ()?

In .NET, under what circumstances should GC.SuppressFinalize() be used? What are the advantages of using this method? Note: I found the answer in the SO-en: When should I use GC.SuppressFinalize ()? As I did not have something r...
asked by 08.12.2015 / 14:35
2
answers

Managing and releasing memory

1) When I create an object, where it has arrays and large variables, setting them to null , will it help with the reduction? Within a method Dispose() - being that before they were with some value. 2) When I call a Dispose()...
asked by 02.12.2017 / 02:13
2
answers

Why is it necessary to close the file?

Why is this line required in Java? fout.close(); Context: LinkedList values = new LinkedList(classe.getTurma().values()); if (!values.isEmpty()) { FileOutputStream fout = null; String FILE = "TURMA"; try {...
asked by 30.11.2017 / 17:59
1
answer

Dispose () method

dispose() frees the object from memory, right? I do not know when it is necessary to use it. For example, I have a page, on this page there is listBox com visible = "false" , in an event this listBox becomes true...
asked by 23.12.2016 / 14:00
1
answer

Nested dispose is required?

I have the following hypothetical code. using (var QDR = new DAL.teste()) { //codigos using (var QDR1 = new DAL.teste1()) { //codigos using (var QDR2 = new DAL.teste2()) { // códigos } } } Is...
asked by 27.06.2016 / 15:39
2
answers

Context Dispose should be used in ASP.NET MVC?

In Web Forms whenever I mounted some kind of CRUD , I used using to make an implen in>. public List<Produtos> Lista () { using (var ctx = new DbContext()) { return ctx. Produtos.ToList(); } } In ASP.NET MVC th...
asked by 24.03.2016 / 19:47
2
answers

Should I ensure that threads end in Dispose?

Some questions about the interface IDisposable and using already exist, for example: What types of features are released in a using statement I should always use the dispose I'm still not sure what to do about threads...
asked by 07.11.2016 / 15:18
1
answer

File close

I need to leave the file free, without being in use because it is barring. Here is the code: StringWriter sw = new StringWriter(); XmlTextWriter tw = new XmlTextWriter(sw); XmlSerializerNamespaces xsn = new XmlSerializerNamespaces(); xsn.Add(...
asked by 18.08.2017 / 14:09
1
answer

Dispose in Unit Of Work

I have a web application and I'm using repository * and Unit Of Work . In some examples I saw that after performing some change operation on the bank we should call the Dispose() method. Instantiated UnitOfWork : priv...
asked by 04.12.2017 / 13:23