SharedProperty Class
.NET Framework (current version)
Accesses a shared property. This class cannot be inherited.
Assembly: System.EnterpriseServices (in System.EnterpriseServices.dll)
| Name | Description | |
|---|---|---|
![]() | Value | Gets or sets the value of the shared property. |
| Name | Description | |
|---|---|---|
![]() | Equals(Object) | Determines whether the specified object is equal to the current object.(Inherited from Object.) |
![]() | GetHashCode() | Serves as the default hash function. (Inherited from Object.) |
![]() | GetType() | |
![]() | ToString() | Returns a string that represents the current object.(Inherited from Object.) |
The following code example shows how to create a shared property and set and retrieve the value stored in the shared property.
Imports System Imports System.EnterpriseServices Imports System.Reflection <Assembly: ApplicationName("ReceiptNumberGenerator")> <Assembly: ApplicationActivation(ActivationOption.Library)> Public Class ReceiptNumberGeneratorClass ' Generates a new receipt number based on the receipt number ' stored by the Shared Property Manager (SPM) Public Function GetNextReceiptNumber() As Integer Dim groupExists, propertyExists As Boolean Dim nextReceiptNumber As Integer = 0 Dim lockMode As PropertyLockMode = PropertyLockMode.SetGet Dim releaseMode As PropertyReleaseMode = PropertyReleaseMode.Standard ' Create a shared property group manager. Dim groupManager As New SharedPropertyGroupManager() ' Create a shared property group. Dim group As SharedPropertyGroup = groupManager.CreatePropertyGroup("Receipts", lockMode, releaseMode, groupExists) ' Create a shared property. Dim ReceiptNumber As SharedProperty ReceiptNumber = group.CreateProperty("ReceiptNumber", propertyExists) ' Retrieve the value from shared property, and increment the shared ' property value. nextReceiptNumber = Fix(ReceiptNumber.Value) ReceiptNumber.Value = nextReceiptNumber + 1 ' Return nextReceiptNumber Return nextReceiptNumber End Function 'GetNextReceiptNumber End Class 'ReceiptNumberGeneratorClass
.NET Framework
Available since 1.1
Available since 1.1
Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:

