IBackupRestore.Id property
取得或設定內容元件的識別碼。
Namespace: Microsoft.SharePoint.Administration.Backup
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Syntax
'宣告
Property Id As Guid
Get
Set
'用途
Dim instance As IBackupRestore
Dim value As Guid
value = instance.Id
instance.Id = value
Guid Id { get; set; }
Property value
Type: System.Guid
Guid 可識別IBackupRestore物件所表示的內容元件。
備註
如果您的類別衍生自SPPersistedObject項目,不會實作此成員。
在大多數情況下,您可以實作Id屬性來建立名稱值的私用欄位,並為欄位周圍的包裝函式實作公用屬性。請考慮擁有建立值, get accessor 如果先前尚未設定屬性。請參閱範例。
Examples
下列程式碼範例會顯示實作,以確保它將會一律傳回有效GuidId屬性。
private Guid id;
public Guid Id
{
get
{
if (id == Guid.Empty)
{
id = Guid.NewGuid;
}
return id;
}
set {id = value;}
}
Private _id As Guid
Public Property Id() As Guid
Get
If id = Guid.Empty Then
id = Guid.NewGuid
End If
Return id
End Get
Set(ByVal value As Guid)
id = value
End Set
End Property