Beta 2:自动处理不作为? [英] Beta 2: Automatic Dispose inaction?

查看:91
本文介绍了Beta 2:自动处理不作为?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,


由于FileStream类中缺少复制构造函数,以下内容无法编译:


FileInfo ^ fi = ...;

FileStream fs = fi-> OpenRead();


编译器是Beta 2.是否支持?计划得到支持吗?

解决方案

Alexei写道:

你好,

以下内容由于FileStream类中缺少复制构造函数而无法编译:

FileInfo ^ fi = ...;
FileStream fs = fi-> OpenRead();




FileStream ^ fs = fi-> OpenRead();


-cd


Carl Daniel [VC ++ MVP]写道:

Alexei写道:

你好,

以下不做由于在FileStream类中缺少复制构造函数而编译:

FileInfo ^ fi = ...;
FileStream fs = fi-> OpenRead();


FileStream ^ fs = fi-> OpenRead();




不要回答只是为了回答。请看这里: http://blogs.msdn.com/arich/ (DF

模式)。




" Alexei Zakharov" <人******** @ at.gmail.com>在消息中写道

news:uu ************** @ TK2MSFTNGP15.phx.gbl ...

Carl Daniel [VC ++ MVP ]写道:

Alexei写道:

你好,

由于缺少复制构造函数,以下内容无法编译
在类FileStream中:

FileInfo ^ fi = ...;
FileStream fs = fi-> OpenRead();



FileStream ^ fs = fi-> OpenRead();



不要只回答回答。请看这里: http://blogs.msdn.com/arich/ (DF
模式)。




此模式仅适用于C ++ / CLI实现的类,FCL用
$ b $编写b C#和他们的类不能堆栈分配。所以,你应该做的是,

在堆上分配对象并手动处理。


Willy。


Hello,

The following doesn''t compile due to absence of the copy constructor in class FileStream:

FileInfo ^ fi = ...;
FileStream fs = fi->OpenRead();

The compiler is Beta 2. Is this supported? Planned to be supported?

解决方案

Alexei wrote:

Hello,

The following doesn''t compile due to absence of the copy constructor
in class FileStream:

FileInfo ^ fi = ...;
FileStream fs = fi->OpenRead();



FileStream^ fs = fi->OpenRead();

-cd


Carl Daniel [VC++ MVP] wrote:

Alexei wrote:

Hello,

The following doesn''t compile due to absence of the copy constructor
in class FileStream:

FileInfo ^ fi = ...;
FileStream fs = fi->OpenRead();



FileStream^ fs = fi->OpenRead();



Don''t answer just to answer. Look here: http://blogs.msdn.com/arich/ (DF
pattern).



"Alexei Zakharov" <al********@at.gmail.com> wrote in message
news:uu**************@TK2MSFTNGP15.phx.gbl...

Carl Daniel [VC++ MVP] wrote:

Alexei wrote:

Hello,

The following doesn''t compile due to absence of the copy constructor
in class FileStream:

FileInfo ^ fi = ...;
FileStream fs = fi->OpenRead();



FileStream^ fs = fi->OpenRead();



Don''t answer just to answer. Look here: http://blogs.msdn.com/arich/ (DF
pattern).



This pattern is for C++/CLI implemented classes only, the FCL are written in
C# and their classes can''t be "stack allocated". So, what you should do is,
allocate the object on the heap and manually dispose.

Willy.


这篇关于Beta 2:自动处理不作为?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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