On Wed, May 9, 2012 at 4:08 PM, Paul Hill <[email protected]> wrote:
> On 9 May 2012 20:00, Stephen Russell <[email protected]> wrote:
>>  // fill customer data object from ID
>> using (RingEDIEntities db = new RingEDIEntities())    << Entity Framework 
>> here
>> {
>> ...
>> }
>
> It's interesting how the using statment works. The c# compiler actualy
> translates this into a try...catch.
----------------------------

A lot more than that.

<http://msdn.microsoft.com/en-us/library/yh598w02(v=vs.80).aspx>

It will dispose of all leftovers within the statement, or so they say....



> RingEDIEntities db;
> try
> {
>   db = new RingEDIEntities();
> }
> catch
> {
> }
> finally
> {
>   db.Dispose()
> }
>
> lock() works in a similar way.  This translates also to a try..catch
>
> lock(myObject)
> {
>   // Thread sensitive code
> }
>
> For me, I've been writing c/c++ code for 20 years, so I love c# syntax :-)
>
> --
> Paul
>
[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/CAJidMYJsUi=+r20Y06L0czR7na47dGTpHOon5pFxHAq=c-p...@mail.gmail.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to