如何找到TextWriter / StreamWriter? [英] How can I find if a TextWriter / StreamWriter is disposed?

查看:79
本文介绍了如何找到TextWriter / StreamWriter?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

没有IsDisposed()方法。我可以访问它,然后抓住

ObjectDisposedException,但这看起来很难看。


Zytan

There is no IsDisposed() method. I could just access it, and catch
ObjectDisposedException, but that seems ugly.

Zytan

推荐答案

你好Zytan,


你要复制什么?也许我们''WeakReference帮助你?


---

WBR,Michael Nemtsev [C#MVP]。

我的博客: http://spaces.live.com/laflour

团队博客: http://devkids.blogspot.com/


对我们大多数人来说,最大的危险并不是我们的目标太高而且我们错过了它,但它太低了,我们就达不到它了。 (c)米开朗基罗


Z没有IsDisposed()方法。我可以访问它,然后抓住

ZObjectDisposedException,但这看起来很难看。

Z>

ZZytan

Z>
Hello Zytan,

What are u gonna reproduce? Maybe usin'' WeakReference helps u?

---
WBR, Michael Nemtsev [C# MVP].
My blog: http://spaces.live.com/laflour
Team blog: http://devkids.blogspot.com/

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

ZThere is no IsDisposed() method. I could just access it, and catch
ZObjectDisposedException, but that seems ugly.
Z>
ZZytan
Z>





你想做什么?


" Zytan" < zy ********** @ gmail.comwrote in message

news:11 ******************** **@l77g2000hsb.googlegr oups.com ...
Hi,

What are you trying to do?

"Zytan" <zy**********@gmail.comwrote in message
news:11**********************@l77g2000hsb.googlegr oups.com...

没有IsDisposed()方法。我可以访问它,然后抓住

ObjectDisposedException,但这看起来很难看。


Zytan
There is no IsDisposed() method. I could just access it, and catch
ObjectDisposedException, but that seems ugly.

Zytan



Zytan< zy ********** @ gmail.comwrote:
Zytan <zy**********@gmail.comwrote:

没有IsDisposed()方法。我可以访问它,并抓住

ObjectDisposedException,但这看起来很难看。
There is no IsDisposed() method. I could just access it, and catch
ObjectDisposedException, but that seems ugly.



我从来没有遇到过这样的情况

但不知道是不是已被处理 - 你的b $ b b情况是什么?你能以某种方式避免它吗?


-

Jon Skeet - < sk *** @ pobox.com>
http://www.pobox.com/~skeet 博客: http://www.msmvps.com/jon.skeet

如果回复对于小组,请不要给我发邮件

I''ve never been in the situation where I have a reference to something
but don''t know whether or not it''s been disposed - what''s your
situation? Can you avoid it somehow?

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too


这篇关于如何找到TextWriter / StreamWriter?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆