将字符串链接到元素,通常在此元素中该字符串为引用(如 URI、modelbus 引用或工作项 ID)。 用名称指示引用的类型。 返回表示链接的 IReference 对象。
命名空间:  Microsoft.VisualStudio.ArchitectureTools.Extensibility.Uml
程序集:  Microsoft.VisualStudio.ArchitectureTools.Extensibility(在 Microsoft.VisualStudio.ArchitectureTools.Extensibility.dll 中)
语法
声明
<ExtensionAttribute> _
Public Shared Function AddReference ( _
    element As IElement, _
    name As String, _
    value As String, _
    allowMultiple As Boolean _
) As IReference
public static IReference AddReference(
    this IElement element,
    string name,
    string value,
    bool allowMultiple
)
[ExtensionAttribute]
public:
static IReference^ AddReference(
    IElement^ element, 
    String^ name, 
    String^ value, 
    bool allowMultiple
)
static member AddReference : 
        element:IElement * 
        name:string * 
        value:string * 
        allowMultiple:bool -> IReference 
public static function AddReference(
    element : IElement, 
    name : String, 
    value : String, 
    allowMultiple : boolean
) : IReference
参数
- element
 类型:Microsoft.VisualStudio.Uml.Classes.IElement
- name
 类型:System.String
 识别引用类型的标识符以及值是如何被打断的。
- value
 类型:System.String
 标识目标对象的字符串。
- allowMultiple
 类型:System.Boolean
 如为 true,则可将具有相同名称的多个值附加到此 IElement。如果为错,同时该名称的引用已经附加到此 IElement 时会引发异常。
返回值
类型:Microsoft.VisualStudio.ArchitectureTools.Extensibility.Uml.IReference
使用说明
在 Visual Basic 和 C# 中,可以在 IElement 类型的任何对象上将此方法作为实例方法来调用。当使用实例方法语法调用此方法时,请省略第一个参数。有关更多信息,请参见扩展方法 (Visual Basic)或扩展方法(C# 编程指南)。
.NET Framework 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。
请参见
参考
Microsoft.VisualStudio.ArchitectureTools.Extensibility.Uml 命名空间