共用方式為


IBackupRestore.Id Property

Gets or sets an ID for the content component.

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
A Guid that identifies the content component that is represented by the IBackupRestore object.

Remarks

If your class derives from SPPersistedObject, do not implement this member.

In most cases, you implement the Id property by creating a private field for the name value and implement the public property as a wrapper around the field. Consider having the get accessor create a value, if the property has not previously been set. See the example.

Examples

The following example code shows an implementation for the Id property that ensures that it will always return a valid Guid.

private Guid id;
public Guid Id
{
get 
    {
        if (id == Guid.Empty)
        {
            id = Guid.NewGuid;
        }
    return id;
    }
set {id = value;}
}

See Also

Reference

IBackupRestore Interface

IBackupRestore Members

Microsoft.SharePoint.Administration.Backup Namespace