编程资料集中营
 | 网站首页 | 文章中心 | 编程资料2 | 软件下载 | BT下载 | 八卦星闻 | 音乐在线 | 在线游戏 | 免费电影 | 进入问吧 | 
[FxCop.设计规则]6. 避免使用输出参数,6.避免使用输出参数原文引用:AvoidoutparametersTypeName:AvoidOutParametersCheckId:CA1021Category:Microsoft.DesignMessageLevel:WarningCertainty:50%BreakingChange:BreakingCause:Apublicorprotectedm,
您现在的位置: 编程资料,学习资料,c,c++,vc,vc++,java,jsp,j2ee,j2me,asp,php >> 文章中心 >> .NET 专区 >> NET 技术 >> 文章正文
【字体:
[FxCop.设计规则]6. 避免使用输出参数   进入问吧

本站地址:http://www.bajiao123.com

作者:admin    文章来源:本站    点击数:    更新时间:2007-6-10    

[FxCop.设计规则]6. 避免使用输出参数

mple

The following example library illustrates how ref parameters for reference types are used, and shows a better way to implement this functionality.

[C#]

using System;

 

namespace DesignLibrary{   public class ReferenceTypesAndParameters   {

 

      // The following syntax will not work. You cannot make a      // reference type that is passed by value point to a new      // instance. This needs the ref keyword.

 

      public static void BadPassTheObject(string argument)      {         argument = argument + " ABCDE";      }

 

      // The following syntax will work, but is considered bad design.      // It reassigns the argument to point to a new instance of string.      // Violates rule DoNotPassTypesByReference.

 

      public static void PassTheReference(ref string argument)      {         argument = argument + " ABCDE&quo

 << 上一页  [11] [12] [13] [14] [15] 下一页

   

进入问吧

本站地址:http://www.bajiao123.com

文章录入:admin    责任编辑:admin 
编程资料集中营