IDesignerSerializationManager.SetName(Object, String) 方法

定义

设置指定的现有对象的名称。Sets the name of the specified existing object.

public:
 void SetName(System::Object ^ instance, System::String ^ name);
public void SetName (object instance, string name);
abstract member SetName : obj * string -> unit
Public Sub SetName (instance As Object, name As String)

参数

instance
Object

要命名的对象实例。The object instance to name.

name
String

提供给实例的名称。The name to give the instance.

注解

如果需要在不使用的情况下创建和命名对象实例,则此方法很有用 CreateInstanceThis method is useful when it is necessary to create and then name an instance of an object without using CreateInstance. 如果试图重命名现有对象或者试图为新对象指定一个已被使用的名称,则将引发异常。An exception is thrown if you try to rename an existing object or if you try to give a new object a name that is already taken.

适用于