• <i id='KtSCD'><tr id='KtSCD'><dt id='KtSCD'><q id='KtSCD'><span id='KtSCD'><b id='KtSCD'><form id='KtSCD'><ins id='KtSCD'></ins><ul id='KtSCD'></ul><sub id='KtSCD'></sub></form><legend id='KtSCD'></legend><bdo id='KtSCD'><pre id='KtSCD'><center id='KtSCD'></center></pre></bdo></b><th id='KtSCD'></th></span></q></dt></tr></i><div id='KtSCD'><tfoot id='KtSCD'></tfoot><dl id='KtSCD'><fieldset id='KtSCD'></fieldset></dl></div>
  • <tfoot id='KtSCD'></tfoot>

        <legend id='KtSCD'><style id='KtSCD'><dir id='KtSCD'><q id='KtSCD'></q></dir></style></legend>

        <small id='KtSCD'></small><noframes id='KtSCD'>

        • <bdo id='KtSCD'></bdo><ul id='KtSCD'></ul>

        清理 Crystal Reports ReportDocument 对象使用的资源的最佳方法是什么?

        时间:2023-07-09

        <small id='uOZN3'></small><noframes id='uOZN3'>

        • <i id='uOZN3'><tr id='uOZN3'><dt id='uOZN3'><q id='uOZN3'><span id='uOZN3'><b id='uOZN3'><form id='uOZN3'><ins id='uOZN3'></ins><ul id='uOZN3'></ul><sub id='uOZN3'></sub></form><legend id='uOZN3'></legend><bdo id='uOZN3'><pre id='uOZN3'><center id='uOZN3'></center></pre></bdo></b><th id='uOZN3'></th></span></q></dt></tr></i><div id='uOZN3'><tfoot id='uOZN3'></tfoot><dl id='uOZN3'><fieldset id='uOZN3'></fieldset></dl></div>

            <tfoot id='uOZN3'></tfoot>

            • <bdo id='uOZN3'></bdo><ul id='uOZN3'></ul>

                1. <legend id='uOZN3'><style id='uOZN3'><dir id='uOZN3'><q id='uOZN3'></q></dir></style></legend>
                    <tbody id='uOZN3'></tbody>
                2. 本文介绍了清理 Crystal Reports ReportDocument 对象使用的资源的最佳方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在开发一个使用 Crystal Reports 进行报告的应用程序.它在 ReportDocument 对象中打开给定的报表,执行它需要执行的操作,然后关闭报表.

                  I am working on an application that uses Crystal Reports for the reporting. It opens a given report in a ReportDocument object, does what it needs to do and then closes the report.

                  using (var report = OpenReport(reportSourceInfo))
                  {
                      // Do stuff with the report
                      report.Close();
                  }
                  

                  OpenReport 方法对源文件进行一些验证并返回一个打开的 ReportDocument 对象.

                  The OpenReport method does some validation of the source file and returns an open ReportDocument object.

                  测试表明,此代码执行了预期的操作,并且似乎没有任何问题.我真正寻求建议的问题是,当我对报告项目进行代码分析 (CA) 构建时,我收到以下 CA 消息:

                  Testing has shown that this code does what it's meant to do and appears to have no issues. The problem I'm really after advice on is when I do a code analysis (CA) build of the reporting project, I get the following CA message:

                  CA2202:Microsoft.Usage:对象report"可以在方法CrystalReportingProvider.ReportExecute(ReportSourceInformation)"中多次处理.为避免生成 System.ObjectDisposedException,您不应在一个对象上多次调用 Dispose.

                  CA2202 : Microsoft.Usage : Object 'report' can be disposed more than once in method 'CrystalReportingProvider.ReportExecute(ReportSourceInformation)'. To avoid generating a System.ObjectDisposedException you should not call Dispose more than one time on an object.

                  现在显然我可以更改代码,所以我不会收到这个 CA 警告,但我的问题是我应该这样做吗?

                  Now obviously I can change the code around so I don't get this CA warning, but my question is should I?

                  Crystal Reports ReportDocument.Close() 方法是否可以正确处理资源清理?该消息似乎表明 Close 方法调用了 Dispose 方法,但这似乎并不正确.

                  Does the Crystal Reports ReportDocument.Close() method do everything to handle resource cleanup properly? The message seems to indicate that the Close method calls the Dispose method, but that just doesn't seem right.

                  任何建议将不胜感激.

                  推荐答案

                  嗯,根据this, "Close() ... 释放报告使用的内存."这表明 Close() 调用了 Dispose(),因此同时使用 using 语句和 Close() 将是多余的.

                  Well, according to this, "Close() ... release[s] the memory that is used by the report." That would indicate that Close() calls Dispose(), so it would be redundant to have both a using statement and Close().

                  这篇关于清理 Crystal Reports ReportDocument 对象使用的资源的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:什么版本的 Crystal Reports 使用 13.0.2000? 下一篇:Crystal Reports - 值不能为空.参数名称:窗口

                  相关文章

                  <small id='vGdTt'></small><noframes id='vGdTt'>

                  <legend id='vGdTt'><style id='vGdTt'><dir id='vGdTt'><q id='vGdTt'></q></dir></style></legend>

                    <tfoot id='vGdTt'></tfoot>
                    <i id='vGdTt'><tr id='vGdTt'><dt id='vGdTt'><q id='vGdTt'><span id='vGdTt'><b id='vGdTt'><form id='vGdTt'><ins id='vGdTt'></ins><ul id='vGdTt'></ul><sub id='vGdTt'></sub></form><legend id='vGdTt'></legend><bdo id='vGdTt'><pre id='vGdTt'><center id='vGdTt'></center></pre></bdo></b><th id='vGdTt'></th></span></q></dt></tr></i><div id='vGdTt'><tfoot id='vGdTt'></tfoot><dl id='vGdTt'><fieldset id='vGdTt'></fieldset></dl></div>
                      <bdo id='vGdTt'></bdo><ul id='vGdTt'></ul>