IPropertySet Interface

Provides access to members for managing a PropertySet.

Description

The IPropertySet interface contains methods to set and retrieve the collection of named value pairs in the PropertySet.

Members

Name Description
Read-only property Count The number of properties contained in the property set.
Method GetAllProperties The name and value of all the properties in the property set.
Method GetProperties The values of the specified properties.
Method GetProperty The value of the specified property.
Method IsEqual True if the property set is the same as the input property set.
Method RemoveProperty Removes a property from the set.
Method SetProperties The values of the specified properties.
Method SetProperty The value of the specified property.

IPropertySet.Count Property

The number of properties contained in the property set.

Public ReadOnly Property Count As Integer
public int Count {get;}

Remarks

The Countvalue will always be one when used with the esriGeodatabase.XmlPropertySet coclass. For more information, see the remarks for the XmlPropertySet coclass.

IPropertySet.GetAllProperties Method

The name and value of all the properties in the property set.

Public Sub GetAllProperties ( _
    ByRef names As Object, _
    ByRef values As Object _
)
public void GetAllProperties (
    ref object names,
    ref object values
);

Remarks

The GetAllPropertiesretrieves all names and values in the property set.

IPropertySet.GetProperties Method

The values of the specified properties.

Public Sub GetProperties ( _
    ByVal names As Object, _
    ByRef values As Object _
)
public void GetProperties (
    object names,
    ref object values
);

Remarks

The GetPropertiesmethod returns values from a PropertySetCoClass.

public Object GetServerProperty(IServerEnvironment3 server, string propertyName="ExtensionName")

{

  Object propertyValue = null;

  IPropertySet serverProps = server.Properties;

  propertyValue = serverProps.GetProperty(propertyName);

  return propertyValue;

}

IPropertySet.GetProperty Method

The value of the specified property.

Public Function GetProperty ( _
    ByVal Name As String _
) As Object
public object GetProperty (
    string Name
);

IPropertySet.IsEqual Method

True if the property set is the same as the input property set.

Public Function IsEqual ( _
    ByVal PropertySet As IPropertySet _
) As Boolean
public bool IsEqual (
    IPropertySet PropertySet
);

Remarks

This method indicates whether two property sets are equal.

Note that it will always return false if the property set is an esriGeodatabase.XmlPropertySet (for metadata). See the XmlPropertySet coclass' documentation for more information.

IPropertySet.RemoveProperty Method

Removes a property from the set.

Public Sub RemoveProperty ( _
    ByVal Name As String _
)
public void RemoveProperty (
    string Name
);

IPropertySet.SetProperties Method

The values of the specified properties.

Public Sub SetProperties ( _
    ByVal names As Object, _
    ByVal values As Object _
)
public void SetProperties (
    object names,
    object values
);

Remarks

Using the Nameparameter to locate the specified element, the SetProperties method populates the elements, or adds an new element if it already exists, and sets the value to the coorseponding Valuesparameter.

The Name parameter uses XSL Patterns to specify metadata elements. Additional information on XSL can be found in the the IXmlPropertySet documentation.

esriXmlSetPropertyAction constants are NOT available to handle situations where an element value already exists. Upon encountering elements that already have values, the new values will replace or add values to existing elements. For more control dealing with elements the IXmlPropertySet::SetPropertyX should be used.

In order to populated nodes further along in the Xml tree, nodes necessary to navigate must first be established. For instance in order to populate the "idinfo/ptcontact/cntinfo/cntperp/cntorg" node each subsequent nodes, "idinfo", "idinfo/ptcontact", "idinfo/ptcontact/cntinfo" and "idinfo/ptcontact/cntinfo/cntperp" must already be in place.

IPropertySet.SetProperty Method

The value of the specified property.

Public Sub SetProperty ( _
    ByVal Name As String, _
    ByVal Value As Object _
)
public void SetProperty (
    string Name,
    object Value
);

Remarks

The Name parameter uses XSL Patterns to specify metadata elements. Additional information on XSL can be found in the the IXmlPropertySet documentation.

Classes that implement IPropertySet

Classes Description
PropertySet Esri Property Set object.
RasterFunctionTemplateArguments (esriDataSourcesRaster) A class for template function arguments.
XmlPropertySet (esriGeoDatabase) Esri XML PropertySet object.

Remarks

PropertySet is a generic class that is used to hold a set of properties for anything. One example for the use of a property set is to hold the properties required for opening up an SDE workspace as is shown in the example code.

Typically a property set can be thought of as a set of keys (strings) and values (variants/objects). One notable exception to this is when using the IPropertySet interface on an XmlPropertySet object. An XML document can contain multiple elements with the same name (i.e. "property/child") and different values. Because of this, the values returned by this interface from an XmlPropertySet may be jagged two-dimensional arrays (arrays containing other arrays). See the XmlPropertySet coclass' documentation in the Geodatabase library for more details and code examples.

public Object GetServerProperty(string propertyName)

{

  Type envMgrType = Type.GetTypeFromProgID("esriSystem.EnvironmentManager");

  object envMgrObj = Activator.CreateInstance(envMgrType);

  IEnvironmentManager envMgr = envMgrObj as IEnvironmentManager;

  UID envUID = new UIDClass();

  envUID.Value = "{32D4C328-E473-4615-922C-63C108F55E60}";

  IServerEnvironment2 serverEnvironment = (IServerEnvironment2)envMgr.GetEnvironment(envUID);

  IPropertySet serverProps = serverEnvironment.Properties;

  object propertyValue = serverProps.GetProperty(propertyName);



  return propertyValue;

}

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.