Share via


SPUsageDefinition.GetLocal<T> method

This static method is used instead of the constructor to create a new instance of the derived SPUsageDefinition class, if necessary, and to retrieve it from the database.

Namespace:  Microsoft.SharePoint.Administration
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'Declaration
Public Shared Function GetLocal(Of T As {New, SPUsageDefinition}) As T
'Usage
Dim returnValue As T

returnValue = SPUsageDefinition.GetLocal()
public static T GetLocal<T>()
where T : new(), SPUsageDefinition

Type parameters

  • T
    The name of the object that was derived from the SPUsageDefinition class to be retrieved.

Return value

Type: T
If an existing instance of the derived object can be found in the database, this method returns it. Otherwise, if an instance of the derived object cannot be found in the database, this method creates and returns a new instance.

Remarks

Classes that are derived from this one should include a read-only property called Local to get the local instance of the derived usage definition object. For example:

public static SPUsageDefinitionDerived1 Local 
     { 
       get 
       { 
          return GetLocal<SPUsageDefinitionDerived1>(); 
       } 
     }

See also

Reference

SPUsageDefinition class

SPUsageDefinition members

Microsoft.SharePoint.Administration namespace