Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / CLR / July 2006

Tip: Looking for answers? Try searching our database.

which .NET assembly/class has 'using' inside

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Michael Nemtsev - 23 Jul 2006 20:19 GMT
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/


Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.