W
W
wkololo_4ever2014-03-26 10:42:11
C++ / C#
wkololo_4ever, 2014-03-26 10:42:11

Is the object being destroyed?

There is a piece of code like this

using(var contactContext=new ContactsContext())
            {
                var tel = contactContext.Telephones.Where(t => t.ContactId == idContact).Where(t => t.TelephoneId > idOldTelephone).ToArray();
                return tel;
            }

that is, return before the closing bracket. Does contactContext get destroyed?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
AlexP11223, 2014-03-26
@wkololo_4ever

Yes.
Have you tried googling? The first link on request "using return".
stackoverflow.com/questions/3247617/what-happens-i...
And you could also look on msdn (or anywhere) that using is actually a try-finally.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question