Who knows, which .NET assembly/class has 'using' inside?
I've tried to check several classes with Reflector but found nothig.
I wonder whether .net FW classes use 'using' or everything realized with
try...finaly statements by hand?
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour
"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Scott M. - 23 Jul 2006 20:33 GMT
The classes don't have *using* in them. *using* is a language element of
C#.
> Who knows, which .NET assembly/class has 'using' inside? I've tried to
> check several classes with Reflector but found nothig.
[quoted text clipped - 8 lines]
> "At times one remains faithful to a cause only because its opponents do
> not cease to be insipid." (c) Friedrich Nietzsche
Michael Nemtsev - 23 Jul 2006 20:45 GMT
Hello Scott M.,
S> The classes don't have *using* in them. *using* is a language
S> element of C#.
Why then I can see the *using* statement in my own code with Reflector?
S>
S> "Michael Nemtsev" <nemtsev@msn.com> wrote in message
S> news:1799a79b3a17e08c87cc58de92009@msnews.microsoft.com...
S>
>> Who knows, which .NET assembly/class has 'using' inside? I've tried
>> to check several classes with Reflector but found nothig.
>>
>> I wonder whether .net FW classes use 'using' or everything realized
>> with try...finaly statements by hand?
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour
"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsch
Barry Kelly - 23 Jul 2006 21:54 GMT
> Why then I can see the *using* statement in my own code with Reflector?
Because Reflector uses heuristics and pattern-matching to decompile IL.
-- Barry

Signature
http://barrkel.blogspot.com/
Jon Shemitz - 23 Jul 2006 20:35 GMT
> Who knows, which .NET assembly/class has 'using' inside?
> I've tried to check several classes with Reflector but found nothig.
Well, as has been pointed out, `using` is a language feature, and
produces the same IL as a manual try/finally.
> I wonder whether .net FW classes use 'using' or everything realized with
> try...finaly statements by hand?
Why? Do you think there's some point to avoiding using statements?

Signature
.NET 2.0 for Delphi Programmers www.midnightbeach.com/.net
Delphi skills make .NET easy to learn In print, in stores.
Michael Nemtsev - 23 Jul 2006 20:49 GMT
Hello Jon,
>> I wonder whether .net FW classes use 'using' or everything realized
>> with try...finaly statements by hand?
JS> Why? Do you think there's some point to avoiding using statements?
Just because in case of *using* some initialization code generated before
autogenerated *try* statement.
I'd like to check how this is realized in FW classes - whether with *using*
or not
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour
"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Barry Kelly - 23 Jul 2006 22:09 GMT
> Who knows, which .NET assembly/class has 'using' inside?
> I've tried to check several classes with Reflector but found nothig.
Here are some entries that call .Dispose() without 'using' in the BCL,
from SSCLI 2.0 (Rotor):
---8<---
./io/directory.cs:650
./io/directory.cs:711
./io/filestream.cs:661
./io/isolatedstorage/isolatedstoragefile.cs:728
./io/stream.cs:474
./io/textreader.cs:213
./io/textwriter.cs:539
./reflection/emit/aqnbuilder.cs:77
./resources/resourcemanager.cs:685
./runtime/interopservices/safehandle.cs:247
./runtime/remoting/synchronizeddispatch.cs:603
./runtime/remoting/synchronizeddispatch.cs:799
./runtime/remoting/terminatorsinks.cs:608
./runtime/remoting/terminatorsinks.cs:689
./threading/mutex.cs:114
./threading/timer.cs:391
--->8---
(Obtained via:
clr/src/bcl/system
$ grep -nr '.Dispose()' . | grep -v void | cut -d ':' -f 1,2
)
Here are some entries that call .Dispose() with 'using' in the BCL:
---8<---
./appdomain.cs:1392
./bcldebug.cs:351
./collections/generic/list.cs:88
./collections/generic/list.cs:642
./io/directory.cs:283
./io/directory.cs:321
./io/directory.cs:359
./io/directory.cs:1011
./io/file.cs:130
./io/file.cs:310
./io/file.cs:356
./io/file.cs:402
./io/file.cs:492
./io/file.cs:507
./io/file.cs:516
./io/file.cs:542
./io/file.cs:560
./io/file.cs:581
./io/file.cs:597
./io/isolatedstorage/isolatedstoragefile.cs:1372
./io/isolatedstorage/isolatedstoragefile.cs:1706
./reflection/assembly.cs:989
./security/policy/applicationtrust.cs:351
./security/policy/policylevel.cs:884
./security/securitymanager.cs:138
./security/securitymanager.cs:139
--->8---
(Obtained via:
clr/src/bcl/system$
egrep -nr '^[ ]+using.*\(' . | cut -d ':' -f 1,2
)
-- Barry

Signature
http://barrkel.blogspot.com/