FileCodeModel.AddAttribute 方法

更新:2007 年 11 月

创建新的属性代码构造,并将代码插入正确的位置。

命名空间:  EnvDTE
程序集:  EnvDTE(在 EnvDTE.dll 中)

语法

声明
Function AddAttribute ( _
    Name As String, _
    Value As String, _
    Position As Object _
) As CodeAttribute
用法
Dim instance As FileCodeModel
Dim Name As String
Dim Value As String
Dim Position As Object
Dim returnValue As CodeAttribute

returnValue = instance.AddAttribute(Name, _
    Value, Position)
CodeAttribute AddAttribute(
    string Name,
    string Value,
    Object Position
)
CodeAttribute^ AddAttribute(
    String^ Name, 
    String^ Value, 
    Object^ Position
)
function AddAttribute(
    Name : String, 
    Value : String, 
    Position : Object
) : CodeAttribute

参数

  • Value
    类型:System.String

    必选。属性的值,该值可以是以逗号分隔的参数化属性的参数列表。

  • Position
    类型:System.Object

    可选。默认为 0。将在其后添加新元素的代码元素。如果该值为 CodeElement,则紧跟在其后添加新元素。

    如果该值为 Long 数据类型,则 AddAttribute 指示在哪个元素的后面添加新元素。

    因为集合从 1 开始计数,所以传递 0 指示应将新元素放置在集合的开始处。值为 -1 表示应将元素放在结尾处。

返回值

类型:EnvDTE.CodeAttribute

一个 CodeAttribute 对象。

备注

如果该属性已存在,则 AddAttribute 将添加另一个属性。这对于代码模型后面的属性或语言可能是不正确的。

权限

另请参见

参考

FileCodeModel 接口

FileCodeModel 成员

EnvDTE 命名空间

其他资源

如何:编译和运行自动化对象模型代码示例