Terradue.OpenSearch.OpenSearchParameterValueSet.GetValuesByIdentifier C# (CSharp) Method

GetValuesByIdentifier() public method

Returns the values of the parameter specified by its identifier.
public GetValuesByIdentifier ( string identifier ) : string[]
identifier string The parameter identifier, i.e. the fully qualified identifier between the curly brackets in the OpenSearch description URL template, e.g. "geo:box".
return string[]
        public string[] GetValuesByIdentifier(string identifier)
        {
            if (!parametersByIdentifier.ContainsKey(identifier)) return null;
            OpenSearchParameterDefinition paramDef = parametersByIdentifier[identifier];
            if (!values.ContainsKey(paramDef)) return null;
            return values[paramDef];
        }

Same methods

OpenSearchParameterValueSet::GetValuesByIdentifier ( string namespaceUri, string localName ) : string[]

Usage Example

コード例 #1
0
 //---------------------------------------------------------------------------------------------------------------------
 /// <summary>Sets the parameter values based on the values of another instance.</summary>
 /// <remarks>Only matching parameters are taken into account. The match is made by the fully qualified identifier of the OpenSearch parameters. In the default case it is assumed that the namespace prefixes used for the identifiers refer to the same namespaces in both value sets, however, the namespaces can be verified fully.</remarks>
 /// <param name="source">The OpenSearchParameterValueSet that serves as source.</param>
 /// <param name="verifyNamespaces">If set to <c>true</c>, the parameters are matched by namespace URI and local name, rather than just prefix and local name. The default is <c>false</c>.</param>
 public void TranslateFrom(OpenSearchParameterValueSet source, bool verifyNamespaces = false)
 {
     foreach (string identifier in parametersByIdentifier.Keys) {
         OpenSearchParameterDefinition paramDef = parametersByIdentifier[identifier];
         string[] sourceValues;
         if (verifyNamespaces && paramDef.IdentifierNamespaceUri != null) {
             sourceValues = source.GetValuesByIdentifier(paramDef.IdentifierNamespaceUri, paramDef.IdentifierLocalName);
         } else {
             sourceValues = source.GetValuesByIdentifier(identifier);
         }
         if (sourceValues != null) this.values[parametersByIdentifier[identifier]] = sourceValues;
     }
 }