• MARS Website
  • Core API
  • SmartOpenHamburg API
  • Model Components API
  • Common API
Show / Hide Table of Contents
  • Mars.Common
    • GeoHash
    • GeoHashDecoder
    • GeohashDecodeResult
    • GeoHashEncoder
    • GeoHashPrecision
    • Hyperrectangle
    • InputHashHelper
    • PositionHelper
  • Mars.Common.Collections
    • BinaryArrayHeap<T>
    • DoubleBits
    • FibonacciHeap<T, TKey>
    • FibonacciHeapDoubleKey<T>
    • FibonacciHeapNode<T, TKey>
    • FibonacciHeapNodeDoubleKey<T>
    • HeapNode
    • IntervalSize
    • K2DTree<T>
    • K2dTreeNode<T>
    • KdTree
    • KdTree<T>
    • KdTreeBase<TNode>
    • KdTreeNode
    • KdTreeNode<T>
    • KdTreeNodeBase<TNode>
    • KdTreeNodeCollection<TNode>
    • KdTreeNodeList<T>
    • Key
    • Node<T>
    • NodeBase<T>
    • NodeDataContainer<T>
    • NodeDistance<TNode>
    • QuadTree<T>
    • Root<T>
    • TreeDataContainer<T>
  • Mars.Common.Collections.CritBit
    • ICritBitTree<TValue>
  • Mars.Common.Collections.Graph
    • EdgeData
    • GraphData
    • GraphSerializer
    • ISpatialGraph
    • KeyContainer
    • NodeData
    • SpatialGraph
    • SpatialGraphHelper
  • Mars.Common.Collections.Graph.Algorithms
    • AStar
    • CompressedPathDatabase
    • ContractionSearch
    • DepthLimitedTraversal
  • Mars.Common.Collections.Graph.Helper
    • INodeFinder
    • KdTreeNodeFinder
    • RunLengthEncoder
  • Mars.Common.Collections.KNNGraph
    • DefaultRandomGenerator
    • DistanceUtils
    • EventSources
    • EventSources.GraphBuildEventSource
    • EventSources.GraphSearchEventSource
    • IProgressReporter
    • IProvideRandomValues
    • KnnGraph<TItem, TDistance>
    • KnnGraph<TItem, TDistance>.KnnSearchResult
    • KnnGraph<TItem, TDistance>.Parameters
    • Node
    • ReverseComparer<T>
    • ReverseComparerExtensions
    • SelectionKind
    • TravelingCosts<TItem, TDistance>
  • Mars.Common.Compat
    • FormatDecoderAttribute
    • FormatEncoderAttribute
    • FormatHandlerAttribute
    • IntegerAttribute
    • NegativeIntegerAttribute
    • NonnegativeIntegerAttribute
    • NonpositiveIntegerAttribute
    • PositiveIntegerAttribute
  • Mars.Common.Data
    • DomainDataImporter
  • Mars.Common.Data.Providers
    • AscDataProvider
    • GeoJsonFeatureCollectionConverter
    • GeoJsonFeatureConverter
    • GeoJsonHelper
    • GeometryDataProvider
    • GraphMlProvider
    • HttpDataProvider
    • IDataProvider<TInput>
    • JsonFileDataProvider
    • JsonTextDataProvider
    • XmlFileDataProvider
    • XmlTextDataProvider
  • Mars.Common.Exceptions
    • DimensionMismatchException
    • ParseException
  • Mars.Common.IO
    • ExtensionMethods
    • FileClientUtils
    • FileKeys
    • HttpClientUtils
    • ObjectSerialize
    • Serializer
    • SerializerCompression
    • SparseFormat
    • SparseReader
    • SparseWriter
  • Mars.Common.IO.Attributes
    • SerializationBinderAttribute
    • SurrogateSelectorAttribute
  • Mars.Common.IO.Console
    • ChildProgressBar
    • IProgressBar
    • ProgressBar
    • ProgressBarBase
    • ProgressBarHeight
    • ProgressBarOptions
    • ProgressBarSimple
  • Mars.Common.IO.Csv
    • CsvAnalyzer
    • CsvReader
    • CsvReader.RecordEnumerator
    • CsvWriter
    • MissingFieldAction
    • ParseErrorAction
    • ValueTrimmingOptions
  • Mars.Common.IO.Events
    • ParseErrorEventArgs
  • Mars.Common.IO.Exceptions
    • MalformedCsvException
    • MissingFieldCsvException
  • Mars.Common.IO.Mapped
    • Context
    • DefaultArrayFactory
    • Extensions
    • IArrayFactory
    • ISerializableToStream
    • MappedAccessor<T>
    • MemoryMap
    • MemoryMap.CreateAccessorFunc<T>
    • MemoryMap.ReadFromDelegate<T>
    • MemoryMap.WriteToDelegate<T>
    • MemoryMapDelegates
    • MemoryMapDelegates.CreateAccessorFunc<T>
    • MemoryMapStream
  • Mars.Common.IO.Mapped.Accessors
    • MappedAccessorByte
    • MappedAccessorDouble
    • MappedAccessorInt16
    • MappedAccessorInt32
    • MappedAccessorInt64
    • MappedAccessorSingle
    • MappedAccessorUInt16
    • MappedAccessorUInt32
    • MappedAccessorUInt64
    • MappedAccessorVariable<T>
  • Mars.Common.IO.Mapped.Arrays
    • Array<T>
    • ArrayBase<T>
    • ArrayProfile
    • MappedArray<TMapped, T>
    • MappedArray<TMapped, T>.MapFrom
    • MappedArray<TMapped, T>.MapTo
    • MemoryArray<T>
    • VariableArray<T>
  • Mars.Common.IO.Mapped.Collections
    • MemoryBackedDictionary<TKey, TValue>
    • MemoryBackedList<T>
  • Mars.Common.IO.Mapped.Indexes
    • Index<T>
  • Mars.Common.IO.Mapped.Streams
    • CappedStream
  • Mars.Common.Socket
    • ByteOrder
    • CloseEventArgs
    • CloseStatusCode
    • CompressionMethod
    • ErrorEventArgs
    • Ext
    • MessageEventArgs
    • WebSocket
    • WebSocketException
    • WebSocketState
  • Mars.Common.Socket.Server
    • IWebSocketSession
    • WebHeaderCollection
    • WebSocketBehavior
    • WebSocketContext
    • WebSocketServer
    • WebSocketServiceHost
    • WebSocketServiceManager
    • WebSocketSessionManager
  • Mars.Numerics
    • Classes
    • Combinatorics
    • Constants
    • Distance
    • Elementwise
    • Jagged
    • MathematicsException
    • MathHelper
    • Matrix
    • MatrixOrder
    • MatrixType
    • Norm
    • Sort
    • Sorting
    • Sparse
    • Sparse<T>
    • Tools
    • Vector
    • VectorHelper
    • VectorType
  • Mars.Numerics.Comparers
    • ArrayComparer<T>
    • ComparerDirection
    • CustomComparer<T>
    • ElementComparer
    • ElementComparer<T>
    • GeneralComparer
    • StableComparer<T>
  • Mars.Numerics.Distances
    • Angular
    • Chebyshev
    • Cosine
    • Dirac<T>
    • Euclidean
    • Hamming
    • Hamming<T>
    • Haversine
    • Jaccard
    • Jaccard<T>
    • Kulczynski
    • Levenshtein
    • Levenshtein<T>
    • Manhattan
    • Matching
    • Minkowski
    • SquareEuclidean
    • Vincenty
    • Vincenty.Ellipsoid
  • Mars.Numerics.Distances.Base
    • IDistance<T>
    • IDistance<TFirst, TSecond>
    • IMetric<T>
    • ISimilarity<T, TU>
    • ISimilarity<T>
  • Mars.Numerics.Exceptions
    • DimensionMismatchException
    • NonPositiveDefiniteMatrixException
    • SingularMatrixException
  • Mars.Numerics.Formats
    • DefaultMatrixFormatProvider
    • IMatrixFormatProvider
    • MatrixFormatProviderBase
    • MatrixFormatter
    • OctaveMatrixFormatProvider
  • Mars.Numerics.Ranges
    • ByteRange
    • DoubleRange
    • FloatRange
    • IntRange
    • IRange<T>
  • Mars.Numerics.Statistics
    • ConstValueDistribution<T>
    • Distribution<T>
    • FastGaussianDistributionD
    • FastGaussianDistributionF
    • IDistribution
    • UniformDiscreteDistribution
    • UniformDistributionD
    • UniformDistributionF
  • Mars.Numerics.Statistics.Base
    • BinarySearch
    • DistributionBase
    • ISampleableDistribution<TObservations>
    • IUnivariateDistribution
    • IUnivariateDistribution<TObservation>
    • UnivariateDiscreteDistribution

Class Ext

Provides a set of static methods for websocket-sharp.
Inheritance
System.Object
Ext
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Mars.Common.Socket
Assembly: Mars.Common.dll
Syntax
public static class Ext

Methods

| Improve this Doc View Source

Contains(NameValueCollection, String, String)

Determines whether the specified System.Collections.Specialized.NameValueCollection contains the entry with the specified both name and value.
Declaration
public static bool Contains(this NameValueCollection collection, string name, string value)
Parameters
Type Name Description
System.Collections.Specialized.NameValueCollection collection A System.Collections.Specialized.NameValueCollection to test.
System.String name A System.String that represents the key of the entry to find.
System.String value A System.String that represents the value of the entry to find.
Returns
Type Description
System.Boolean true if collection contains the entry with both name and value; otherwise, false.
| Improve this Doc View Source

Contains(NameValueCollection, String)

Determines whether the specified System.Collections.Specialized.NameValueCollection contains the entry with the specified name.
Declaration
public static bool Contains(this NameValueCollection collection, string name)
Parameters
Type Name Description
System.Collections.Specialized.NameValueCollection collection A System.Collections.Specialized.NameValueCollection to test.
System.String name A System.String that represents the key of the entry to find.
Returns
Type Description
System.Boolean true if collection contains the entry with name; otherwise, false.
| Improve this Doc View Source

Contains(String, Char[])

Determines whether the specified System.String contains any of characters in the specified array of System.Char.
Declaration
public static bool Contains(this string value, params char[] chars)
Parameters
Type Name Description
System.String value A System.String to test.
System.Char[] chars An array of System.Char that contains characters to find.
Returns
Type Description
System.Boolean true if value contains any of chars; otherwise, false.
| Improve this Doc View Source

Emit(EventHandler, Object, EventArgs)

Emits the specified System.EventHandler delegate if it isn't null.
Declaration
public static void Emit(this EventHandler eventHandler, object sender, EventArgs e)
Parameters
Type Name Description
System.EventHandler eventHandler A System.EventHandler to emit.
System.Object sender An System.Object from which emits this eventHandler.
System.EventArgs e A System.EventArgs that contains no event data.
| Improve this Doc View Source

Emit<TEventArgs>(EventHandler<TEventArgs>, Object, TEventArgs)

Emits the specified EventHandler<TEventArgs> delegate if it isn't null.
Declaration
public static void Emit<TEventArgs>(this EventHandler<TEventArgs> eventHandler, object sender, TEventArgs e)
    where TEventArgs : EventArgs
Parameters
Type Name Description
System.EventHandler<TEventArgs> eventHandler An EventHandler<TEventArgs> to emit.
System.Object sender An System.Object from which emits this eventHandler.
TEventArgs e A TEventArgs that represents the event data.
Type Parameters
Name Description
TEventArgs The type of the event data generated by the event.
| Improve this Doc View Source

GetDescription(HttpStatusCode)

Gets the description of the specified HTTP status code.
Declaration
public static string GetDescription(this HttpStatusCode code)
Parameters
Type Name Description
System.Net.HttpStatusCode code One of System.Net.HttpStatusCode enum values, indicates the HTTP status code.
Returns
Type Description
System.String A System.String that represents the description of the HTTP status code.
| Improve this Doc View Source

GetStatusDescription(Int32)

Gets the description of the specified HTTP status code.
Declaration
public static string GetStatusDescription(this int code)
Parameters
Type Name Description
System.Int32 code An System.Int32 that represents the HTTP status code.
Returns
Type Description
System.String A System.String that represents the description of the HTTP status code.
| Improve this Doc View Source

IsCloseStatusCode(UInt16)

Determines whether the specified System.UInt16 is in the range of the status code for the WebSocket connection close.
Declaration
public static bool IsCloseStatusCode(this ushort value)
Parameters
Type Name Description
System.UInt16 value A System.UInt16 to test.
Returns
Type Description
System.Boolean true if value is in the range of the status code for the close; otherwise, false.
Remarks

The ranges are the following:

  • 1000-2999: These numbers are reserved for definition by the WebSocket protocol.
  • 3000-3999: These numbers are reserved for use by libraries, frameworks, and applications.
  • 4000-4999: These numbers are reserved for private use.
| Improve this Doc View Source

IsEnclosedIn(String, Char)

Determines whether the specified System.String is enclosed in the specified System.Char.
Declaration
public static bool IsEnclosedIn(this string value, char c)
Parameters
Type Name Description
System.String value A System.String to test.
System.Char c A System.Char to find.
Returns
Type Description
System.Boolean true if value is enclosed in c; otherwise, false.
| Improve this Doc View Source

IsHostOrder(ByteOrder)

Determines whether the specified ByteOrder is host (this computer architecture) byte order.
Declaration
public static bool IsHostOrder(this ByteOrder order)
Parameters
Type Name Description
ByteOrder order One of the ByteOrder enum values, to test.
Returns
Type Description
System.Boolean true if order is host byte order; otherwise, false.
| Improve this Doc View Source

IsLocal(IPAddress)

Determines whether the specified System.Net.IPAddress represents a local IP address.
Declaration
public static bool IsLocal(this IPAddress address)
Parameters
Type Name Description
System.Net.IPAddress address A System.Net.IPAddress to test.
Returns
Type Description
System.Boolean true if address represents a local IP address; otherwise, false.
Remarks
This local means NOT REMOTE for the current host.
| Improve this Doc View Source

IsNullOrEmpty(String)

Determines whether the specified string is null or an empty string.
Declaration
public static bool IsNullOrEmpty(this string value)
Parameters
Type Name Description
System.String value A System.String to test.
Returns
Type Description
System.Boolean true if the string is null or an empty string; otherwise, false.
| Improve this Doc View Source

IsPredefinedScheme(String)

Determines whether the specified System.String is a predefined scheme.
Declaration
public static bool IsPredefinedScheme(this string value)
Parameters
Type Name Description
System.String value A System.String to test.
Returns
Type Description
System.Boolean true if value is a predefined scheme; otherwise, false.
| Improve this Doc View Source

IsUpgradeTo(HttpListenerRequest, String)

Determines whether the specified System.Net.HttpListenerRequest is an HTTP Upgrade request to switch to the specified protocol.
Declaration
public static bool IsUpgradeTo(this HttpListenerRequest request, string protocol)
Parameters
Type Name Description
System.Net.HttpListenerRequest request A System.Net.HttpListenerRequest that represents the HTTP request.
System.String protocol A System.String that represents the protocol name.
Returns
Type Description
System.Boolean true if request is an HTTP Upgrade request to switch to protocol; otherwise, false.
Exceptions
Type Condition
System.ArgumentNullException

request is null.

-or-

protocol is null.

System.ArgumentException protocol is empty.
| Improve this Doc View Source

MaybeUri(String)

Determines whether the specified System.String is a URI string.
Declaration
public static bool MaybeUri(this string value)
Parameters
Type Name Description
System.String value A System.String to test.
Returns
Type Description
System.Boolean true if value may be a URI string; otherwise, false.
| Improve this Doc View Source

SubArray<T>(T[], Int32, Int32)

Retrieves a sub-array from the specified array. A sub-array starts at the specified element position in array.
Declaration
public static T[] SubArray<T>(this T[] array, int startIndex, int length)
Parameters
Type Name Description
T[] array An array of T from which to retrieve a sub-array.
System.Int32 startIndex An System.Int32 that represents the zero-based starting position of a sub-array in array.
System.Int32 length An System.Int32 that represents the number of elements to retrieve.
Returns
Type Description
T[] An array of T that receives a sub-array, or an empty array of T if any problems with the parameters.
Type Parameters
Name Description
T The type of elements in array.
| Improve this Doc View Source

SubArray<T>(T[], Int64, Int64)

Retrieves a sub-array from the specified array. A sub-array starts at the specified element position in array.
Declaration
public static T[] SubArray<T>(this T[] array, long startIndex, long length)
Parameters
Type Name Description
T[] array An array of T from which to retrieve a sub-array.
System.Int64 startIndex A System.Int64 that represents the zero-based starting position of a sub-array in array.
System.Int64 length A System.Int64 that represents the number of elements to retrieve.
Returns
Type Description
T[] An array of T that receives a sub-array, or an empty array of T if any problems with the parameters.
Type Parameters
Name Description
T The type of elements in array.
| Improve this Doc View Source

Times(Int32, Action)

Executes the specified System.Action delegate n times.
Declaration
public static void Times(this int n, Action action)
Parameters
Type Name Description
System.Int32 n An System.Int32 is the number of times to execute.
System.Action action An System.Action delegate that references the method(s) to execute.
| Improve this Doc View Source

Times(Int32, Action<Int32>)

Executes the specified Action<int> delegate n times.
Declaration
public static void Times(this int n, Action<int> action)
Parameters
Type Name Description
System.Int32 n An System.Int32 is the number of times to execute.
System.Action<System.Int32> action An Action<int> delegate that references the method(s) to execute. An System.Int32 parameter to pass to the method(s) is the zero-based count of iteration.
| Improve this Doc View Source

Times(Int64, Action)

Executes the specified System.Action delegate n times.
Declaration
public static void Times(this long n, Action action)
Parameters
Type Name Description
System.Int64 n A System.Int64 is the number of times to execute.
System.Action action An System.Action delegate that references the method(s) to execute.
| Improve this Doc View Source

Times(Int64, Action<Int64>)

Executes the specified Action<long> delegate n times.
Declaration
public static void Times(this long n, Action<long> action)
Parameters
Type Name Description
System.Int64 n A System.Int64 is the number of times to execute.
System.Action<System.Int64> action An Action<long> delegate that references the method(s) to execute. A System.Int64 parameter to pass to the method(s) is the zero-based count of iteration.
| Improve this Doc View Source

Times(UInt32, Action)

Executes the specified System.Action delegate n times.
Declaration
public static void Times(this uint n, Action action)
Parameters
Type Name Description
System.UInt32 n A System.UInt32 is the number of times to execute.
System.Action action An System.Action delegate that references the method(s) to execute.
| Improve this Doc View Source

Times(UInt32, Action<UInt32>)

Executes the specified Action<uint> delegate n times.
Declaration
public static void Times(this uint n, Action<uint> action)
Parameters
Type Name Description
System.UInt32 n A System.UInt32 is the number of times to execute.
System.Action<System.UInt32> action An Action<uint> delegate that references the method(s) to execute. A System.UInt32 parameter to pass to the method(s) is the zero-based count of iteration.
| Improve this Doc View Source

Times(UInt64, Action)

Executes the specified System.Action delegate n times.
Declaration
public static void Times(this ulong n, Action action)
Parameters
Type Name Description
System.UInt64 n A System.UInt64 is the number of times to execute.
System.Action action An System.Action delegate that references the method(s) to execute.
| Improve this Doc View Source

Times(UInt64, Action<UInt64>)

Executes the specified Action<ulong> delegate n times.
Declaration
public static void Times(this ulong n, Action<ulong> action)
Parameters
Type Name Description
System.UInt64 n A System.UInt64 is the number of times to execute.
System.Action<System.UInt64> action An Action<ulong> delegate that references the method(s) to execute. A System.UInt64 parameter to pass to this method(s) is the zero-based count of iteration.
| Improve this Doc View Source

To<T>(Byte[], ByteOrder)

Converts the specified array of System.Byte to the specified type data.
Declaration
public static T To<T>(this byte[] source, ByteOrder sourceOrder)
    where T : struct
Parameters
Type Name Description
System.Byte[] source An array of System.Byte to convert.
ByteOrder sourceOrder One of the ByteOrder enum values, specifies the byte order of source.
Returns
Type Description
T A T converted from source, or a default value of T if source is an empty array of System.Byte or if the type of T isn't System.Boolean, System.Char, System.Double, System.Single, System.Int32, System.Int64, System.Int16, System.UInt32, System.UInt64, or System.UInt16.
Type Parameters
Name Description
T The type of the return. The T must be a value type.
Exceptions
Type Condition
System.ArgumentNullException source is null.
| Improve this Doc View Source

ToByteArray<T>(T, ByteOrder)

Converts the specified value to an array of System.Byte.
Declaration
public static byte[] ToByteArray<T>(this T value, ByteOrder order)
    where T : struct
Parameters
Type Name Description
T value A T to convert.
ByteOrder order One of the ByteOrder enum values, specifies the byte order of the return.
Returns
Type Description
System.Byte[] An array of System.Byte converted from value.
Type Parameters
Name Description
T The type of value. The T must be a value type.
| Improve this Doc View Source

ToHostOrder(Byte[], ByteOrder)

Converts the order of the specified array of System.Byte to the host byte order.
Declaration
public static byte[] ToHostOrder(this byte[] source, ByteOrder sourceOrder)
Parameters
Type Name Description
System.Byte[] source An array of System.Byte to convert.
ByteOrder sourceOrder One of the ByteOrder enum values, specifies the byte order of source.
Returns
Type Description
System.Byte[] An array of System.Byte converted from source.
Exceptions
Type Condition
System.ArgumentNullException source is null.
| Improve this Doc View Source

ToString<T>(T[], String)

Converts the specified array to a System.String that concatenates the each element of array across the specified separator.
Declaration
public static string ToString<T>(this T[] array, string separator)
Parameters
Type Name Description
T[] array An array of T to convert.
System.String separator A System.String that represents the separator string.
Returns
Type Description
System.String A System.String converted from array, or System.String.Empty if array is empty.
Type Parameters
Name Description
T The type of elements in array.
Exceptions
Type Condition
System.ArgumentNullException array is null.
| Improve this Doc View Source

ToUri(String)

Converts the specified System.String to a System.Uri.
Declaration
public static Uri ToUri(this string value)
Parameters
Type Name Description
System.String value A System.String to convert.
Returns
Type Description
System.Uri A System.Uri converted from value or null if the convert has failed.
| Improve this Doc View Source

UrlDecode(String)

URL-decodes the specified System.String.
Declaration
public static string UrlDecode(this string value)
Parameters
Type Name Description
System.String value A System.String to decode.
Returns
Type Description
System.String A System.String that receives the decoded string or value if it is null or empty.
| Improve this Doc View Source

UrlEncode(String)

URL-encodes the specified System.String.
Declaration
public static string UrlEncode(this string value)
Parameters
Type Name Description
System.String value A System.String to encode.
Returns
Type Description
System.String A System.String that receives the encoded string or value if it is null or empty.
| Improve this Doc View Source

WriteContent(HttpListenerResponse, Byte[])

Writes and sends the specified content data with the specified System.Net.HttpListenerResponse.
Declaration
public static void WriteContent(this HttpListenerResponse response, byte[] content)
Parameters
Type Name Description
System.Net.HttpListenerResponse response A System.Net.HttpListenerResponse that represents the HTTP response used to send the content data.
System.Byte[] content An array of System.Byte that represents the content data to send.
Exceptions
Type Condition
System.ArgumentNullException

response is null.

-or-

content is null.

  • Improve this Doc
  • View Source
In This Article
Back to top Copyright © MARS GROUP. HAW Hamburg