您现在的位置是: 软件 > 开发者网络 > 技术跟踪 > XML与.NET专栏 > 正文


-Win xp中的多种网络
-试验试验试验试验
-用Freehand实现位图矢量化
-网络电话面面观

Visual Studio.net中的XML注释
2001-10-18· · ··YESKY

上一页  1 2 3 4 5  下一页


  创建XMLComment.cs源文件

  XMLComment.cs文件是用来创建XML文档的源文件。XML标签及其相关文本在C#代码中被注释掉了。此源文件在编译时,就通过这些XML标签和文本生成XML文档。

  注意:

  XML注释标记是新加入C#的。在文本前面以三斜杠(///)打头,它会告诉编译器斜杠后面的文本是XML注释。我们必须以三斜杠开头以声明这一行为XML注释行。XML注释必须采用XML标签的格式,这样才能生成XML文档。

  1.点击File,再点击Add New Item。Add New Item窗口将显示如图3。

  2.在Categories面板里点击Local Project Items,在Templates面板中点击Code File。

  3.在name字段中键入XMLComment.cs。

   注意:"XMLComment.cs"中间没有空格.


          图3.Add New Item窗口


  4.点击Open.

  5.在页面中敲入下面的代码:

using System;

class XmlElement
{
///
/// Returns the attribute with the given name and
/// namespace

///
/// The name of the attribute
///
/// The namespace of the attribute, or null if
/// the attribute has no namespace
///
/// The attribute value, or null if the attribute
/// does not exist

///
public string GetAttr(string name, string ns) {
return "test";
}
}

  6.点击File,再点击Save XMLComments.cs(或点击Save图标)。该文件就被存到你的项目文件夹中。

  7.点击File,再点击Exit。如果Microsoft Development窗口出现,点击Yes保存你的项目。

上一页  1 2 3 4 5  下一页

【责任编辑:方舟】
【发表评论】【关闭窗口】
■ 相关内容
 XML与面向Web的数据挖掘技术
 轻轻松松做非编——Media Studio Pro 6.0全接触
 Microsoft .NET框架和Visual Studio.NET中的SOAP
 体验Visual Basic升级向导
 基于浏览器的应用程序
 体验Visual Basic.Net的继承和重载
 Visual C#实战体验Hello World
 XML、Web服务和.NET框架
 XML及其技术指南
 神奇的XML--突破CGI权限的约束
 创建股票报价Web服务
感谢 访问天极网,如果您觉得该文章涉及版权问题,请看这里!