IBackupRestore.Name Property
Gets or sets a name, for use in a UI, for the content component.
Namespace: Microsoft.SharePoint.Administration.Backup
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Syntax
Property Name As String
Get
Set
Dim instance As IBackupRestore
Dim value As String
value = instance.Name
instance.Name = value
string Name { get; set; }
Property Value
Type: System.String
A String that names the content component that is represented by the IBackupRestore object.
Remarks
If your class derives from SPPersistedObject, do not implement this member.
The Name property serves as the name of the content component in the UI of stsadm.exe, the UI of Central Administration application, and the UI of any custom backup and restore application. In most cases, you implement the property by creating a private field for the name value and implement the public property as a wrapper around the field.
If the Name property might be read before it has been set, consider designing the get accessor to return the name of the type as a substitute. See the second example below.
If your component gets a name when it is installed and should never be renamed, consider storing localized versions of its name in a set of resource files. Design the get accessor for the property to read the component name from the appropriate file based on the current culture. The set accessor, in such an implementation, would have no code and there would be no private field. See the third example below.
Examples
The following code shows three ways to implement the Name property.
// First example:
private String name;
public String Name
{
get {return name;}
set {name = value;}
}
// Second example:
private String name;
public String Name
{
get
{
if (name == null)
{
name = this.GetType();
}
return name;
}
set {name = value;}
}
// Third example:
// ComponentLookupKey is a constant assigned to the content component.
// LocalizedString uses the current culture to identify which file
// to open andlookup ComponentLookupKey. It returns the string
// assigned in that file to ComponentLookupKey.
public String Name
{
get
{
return LocalizedString(ComponentLookupKey, CultureInfo.CurrentCulture);
}
set {}
}