Class SIPParameters
Represents a series of name value pairs that are optionally included in SIP URIs and also as an additional optional setting on some SIP Headers (Contact, To, From, Via). This class also treats the header value of a SIP URI as a special case of a SIP parameter. The difference between a parameter and a SIP URI header is the start and delimiter characters used.
Inherited Members
Namespace: SipLib.Core
Assembly: SipLib.dll
Syntax
public class SIPParameters
Constructors
| Edit this page View SourceSIPParameters(string?, char)
Parses the name value pairs from a SIP parameter or header string.
Declaration
public SIPParameters(string? sipString, char delimiter)
Parameters
Type | Name | Description |
---|---|---|
string | sipString | Input string containing the parameters |
char | delimiter | Delimeter to use for parsing |
Properties
| Edit this page View SourceCount
Gets the number of parameters
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
int |
Methods
| Edit this page View SourceAreEqual(SIPParameters, SIPParameters)
Determines if SIPParameters objects are equal. Two SIPParameters objects are considered equal if they have the same keys and values. The order of the keys does not affect the equality comparison.
Declaration
public static bool AreEqual(SIPParameters params1, SIPParameters params2)
Parameters
Type | Name | Description |
---|---|---|
SIPParameters | params1 | First SIPParameters object |
SIPParameters | params2 | Second SIPParameters object. |
Returns
Type | Description |
---|---|
bool | Returns true if they are equal or false if they are not |
CopyOf()
Creates a deep copy of this SIPParameters object
Declaration
public SIPParameters CopyOf()
Returns
Type | Description |
---|---|
SIPParameters |
Equals(object?)
Determines if a SIPParameters object is equal to this one. Two SIPParameters objects are considered equal if they have the same keys and values. The order of the keys does not affect the equality comparison.
Declaration
public override bool Equals(object? obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | Input SIPParameters object |
Returns
Type | Description |
---|---|
bool | Returns true if the input SIPParameters object is equal to this one or false if it is not. |
Overrides
| Edit this page View SourceGet(string)
Gets the value of a specified parameter
Declaration
public string? Get(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name | Name of the parameter |
Returns
Type | Description |
---|---|
string | Returns the value of the parameter. Returns null if the dictionary is empty or if the parameter is not in the dictionary. |
GetHashCode()
Calculates the has value for this object.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int |
Overrides
| Edit this page View SourceGetKeyValuePairsFromQuoted(string, char)
Gets the key value pairs from a quoted string into a string array
Declaration
public static string[]? GetKeyValuePairsFromQuoted(string quotedString, char delimiter)
Parameters
Type | Name | Description |
---|---|---|
string | quotedString | Input quoted string |
char | delimiter | Delimeter to use. For example ',' |
Returns
Type | Description |
---|---|
string[] | Returns a string array containing the name value pairs |
GetKeys()
Gets an array of all parameter names (keys)
Declaration
public string[]? GetKeys()
Returns
Type | Description |
---|---|
string[] | Returns an array of all parameter names or null if the dictionary is empty |
Has(string)
Determines if a parameter exists in the dictionary
Declaration
public bool Has(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name | Name of the parameter |
Returns
Type | Description |
---|---|
bool | Returns true if the parameter exists or false if it does not. |
Remove(string)
Removes a named parameter if it exists.
Declaration
public void Remove(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name | Name of the parameter to remove |
RemoveAll()
Clears the dictionary.
Declaration
public void RemoveAll()
Set(string, string?)
Sets a key name to a specified value. If the dictionary does not contain the key then a new key value pair is added.
Declaration
public void Set(string name, string? value)
Parameters
Type | Name | Description |
---|---|---|
string | name | Name of the parameter (key) |
string | value | Value of the parameter |
ToString()
Converts the name value pairs to a string.
Declaration
public string ToString()
Returns
Type | Description |
---|---|
string |
Operators
| Edit this page View Sourceoperator ==(SIPParameters, SIPParameters)
Two SIPParameters objects are considered equal if they have the same keys and values. The order of the keys does not affect the equality comparison.
Declaration
public static bool operator ==(SIPParameters x, SIPParameters y)
Parameters
Type | Name | Description |
---|---|---|
SIPParameters | x | Left-hand SIPParameters object |
SIPParameters | y | Right-hand SIPParameters object |
Returns
Type | Description |
---|---|
bool | True if the two SIPParameters objects are equal or false if they are not. |
operator !=(SIPParameters, SIPParameters)
Not equals operator
Declaration
public static bool operator !=(SIPParameters x, SIPParameters y)
Parameters
Type | Name | Description |
---|---|---|
SIPParameters | x | Left-hand SIPParameters object |
SIPParameters | y | Right-hand SIPParameters object |
Returns
Type | Description |
---|---|
bool | Returns true if the two objects are not equal or false if they are equal |