Class IAttributeCollectionExtension
Contains extension methods for attribute collections.
Inheritance
Inherited Members
Namespace: System.Dynamic.ExpandoObject
Assembly: cs.temp.dll.dll
Syntax
public static class IAttributeCollectionExtension
Methods
AddOrReplace(IAttributeCollection, IEnumerable<Attribute>)
Adds or replaces the existing attributes to/in the given collection of attributes.
Declaration
public static void AddOrReplace(this IAttributeCollection attributes, IEnumerable<Attribute> other)
Parameters
|
IAttributeCollection
attributes
|
|
IEnumerable<Attribute>
other
|
AddOrReplace(IAttributeCollection, Attribute)
Adds a new attribute.
Declaration
public static void AddOrReplace(this IAttributeCollection attributes, Attribute attribute)
Parameters
|
IAttributeCollection
attributes
|
|
Attribute
attribute
|
Contains(IReadonlyAttributeCollection, String, String)
Returns true if the given attribute is found.
Declaration
public static bool Contains(this IReadonlyAttributeCollection attributes, string key, string value)
Parameters
|
IReadonlyAttributeCollection
attributes
|
|
System.String
key
|
|
System.String
value
|
Returns
|
System.Boolean
|
ContainsSame(IReadonlyAttributeCollection, IReadonlyAttributeCollection)
Returns true if the given attribute collection contains the same attributes than the given collection.
Declaration
public static bool ContainsSame(this IReadonlyAttributeCollection attributes, IReadonlyAttributeCollection other)
Parameters
|
IReadonlyAttributeCollection
attributes
|
|
IReadonlyAttributeCollection
other
|
Returns
|
System.Boolean
|
ContainsSame(IReadonlyAttributeCollection, IReadonlyAttributeCollection, String[])
Returns true if the given attribute collection contains the same attributes than the given collection.
Declaration
public static bool ContainsSame(this IReadonlyAttributeCollection attributes, IReadonlyAttributeCollection other, params string[] exclude)
Parameters
|
IReadonlyAttributeCollection
attributes
|
|
IReadonlyAttributeCollection
other
|
|
System.String[]
exclude
|
Returns
|
System.Boolean
|
DeserializeWithSize(Stream)
Deserializes the attribute collection.
Declaration
public static IAttributeCollection DeserializeWithSize(Stream stream)
Parameters
|
Stream
stream
|
Returns
|
IAttributeCollection
|
GetAccessTag(IReadonlyAttributeCollection, IEnumerable<String>)
Searches the attributes collection for the access attributes and returns the associated values.
Declaration
public static string GetAccessTag(this IReadonlyAttributeCollection tags, IEnumerable<string> accessTagHierachy)
Parameters
|
IReadonlyAttributeCollection
tags
The tags to search. |
|
IEnumerable<System.String>
accessTagHierachy
The hierarchy of |
Returns
|
System.String
The best fitting value is returned. |
IsFalse(IReadonlyAttributeCollection, String)
Returns true if the given tags key has an associated value that can be interpreted as false.
Declaration
public static bool IsFalse(this IReadonlyAttributeCollection tags, string tagKey)
Parameters
|
IReadonlyAttributeCollection
tags
|
|
System.String
tagKey
|
Returns
|
System.Boolean
|
IsTrue(IReadonlyAttributeCollection, String)
Returns true if the given tags key has an associated value that can be interpreted as true.
Declaration
public static bool IsTrue(this IReadonlyAttributeCollection tags, string tagKey)
Parameters
|
IReadonlyAttributeCollection
tags
|
|
System.String
tagKey
|
Returns
|
System.Boolean
|
SerializeWithSize(IAttributeCollection, Stream)
Serializes this attribute collection with size.
Declaration
public static long SerializeWithSize(this IAttributeCollection attributes, Stream stream)
Parameters
|
IAttributeCollection
attributes
|
|
Stream
stream
|
Returns
|
System.Int64
|
SetSingle(IAttributeCollection, String, Single)
Sets a single value.
Declaration
public static void SetSingle(this IAttributeCollection attributes, string key, float value)
Parameters
|
IAttributeCollection
attributes
|
|
System.String
key
|
|
System.Single
value
|
ToStringEmptyWhenNull(Object)
Returns the result of the ToString() method or an empty string when the given object is null.
Declaration
public static string ToStringEmptyWhenNull(this object obj)
Parameters
|
System.Object
obj
|
Returns
|
System.String
|
TryGetMaxAxleLoad(IReadonlyAttributeCollection, out Single)
Searches for a max axle load tag and returns the associated value.
Declaration
public static bool TryGetMaxAxleLoad(this IReadonlyAttributeCollection tags, out float kilogram)
Parameters
|
IReadonlyAttributeCollection
tags
|
|
System.Single
kilogram
|
Returns
|
System.Boolean
|
TryGetMaxHeight(IReadonlyAttributeCollection, out Single)
Searches for a max height tag and returns the associated value.
Declaration
public static bool TryGetMaxHeight(this IReadonlyAttributeCollection tags, out float meter)
Parameters
|
IReadonlyAttributeCollection
tags
|
|
System.Single
meter
|
Returns
|
System.Boolean
|
TryGetMaxLength(IDictionary<String, String>, out Single)
Searches for a max length tag and returns the associated value.
Declaration
public static bool TryGetMaxLength(this IDictionary<string, string> tags, out float meter)
Parameters
|
IDictionary<System.String, System.String>
tags
The tags to search. |
|
System.Single
meter
|
Returns
|
System.Boolean
|
TryGetMaxSpeed(IReadonlyAttributeCollection, out Single)
Searches for a maxspeed tag and returns the associated value.
Declaration
public static bool TryGetMaxSpeed(this IReadonlyAttributeCollection attributes, out float kmPerHour)
Parameters
|
IReadonlyAttributeCollection
attributes
|
|
System.Single
kmPerHour
|
Returns
|
System.Boolean
|
TryGetMaxWeight(IReadonlyAttributeCollection, out Single)
Searches for a maxweight tag and returns the associated value.
Declaration
public static bool TryGetMaxWeight(this IReadonlyAttributeCollection tags, out float kilogram)
Parameters
|
IReadonlyAttributeCollection
tags
|
|
System.Single
kilogram
|
Returns
|
System.Boolean
|
TryGetMaxWidth(IReadonlyAttributeCollection, out Single)
Searches for a max width tag and returns the associated value.
Declaration
public static bool TryGetMaxWidth(this IReadonlyAttributeCollection attributes, out float meter)
Parameters
|
IReadonlyAttributeCollection
attributes
The tags to search. |
|
System.Single
meter
|
Returns
|
System.Boolean
|
TryGetSingle(IReadonlyAttributeCollection, String, out Single)
Tries to get a single value for the given key.
Declaration
public static bool TryGetSingle(this IReadonlyAttributeCollection attributes, string key, out float value)
Parameters
|
IReadonlyAttributeCollection
attributes
|
|
System.String
key
|
|
System.Single
value
|
Returns
|
System.Boolean
|
TryParseKilometerPerHour(String, out Single)
Tries to parse a string containing a kilometer per hour value.
Declaration
public static bool TryParseKilometerPerHour(string s, out float kmPerHour)
Parameters
|
System.String
s
|
|
System.Single
kmPerHour
|
Returns
|
System.Boolean
|
TryParseKnots(String, out Single)
Tries to parse a string containing knots.
Declaration
public static bool TryParseKnots(string s, out float knots)
Parameters
|
System.String
s
|
|
System.Single
knots
|
Returns
|
System.Boolean
|
TryParseLength(String, out Single)
Tries to parse a distance measure from a given tag-value.
Declaration
public static bool TryParseLength(string s, out float meter)
Parameters
|
System.String
s
|
|
System.Single
meter
|
Returns
|
System.Boolean
|
TryParseMilesPerHour(String, out Single)
Tries to parse a string containing a miles per hour value.
Declaration
public static bool TryParseMilesPerHour(string s, out float milesPerHour)
Parameters
|
System.String
s
|
|
System.Single
milesPerHour
|
Returns
|
System.Boolean
|
TryParseSpeed(String, out Single)
Tries to parse a speed value from a given tag-value.
Declaration
public static bool TryParseSpeed(string s, out float kmPerHour)
Parameters
|
System.String
s
|
|
System.Single
kmPerHour
|
Returns
|
System.Boolean
|
TryParseWeight(String, out Single)
Tries to parse a weight value from a given tag-value.
Declaration
public static bool TryParseWeight(string s, out float kilogram)
Parameters
|
System.String
s
|
|
System.Single
kilogram
|
Returns
|
System.Boolean
|