Search Results for

    Show / Hide Table of Contents

    Class StringUtil

    Helpful methods for converting objects to strings.

    Inheritance
    Object
    StringUtil
    Inherited Members
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Object.ReferenceEquals(Object, Object)
    Object.ToString()
    Namespace: Microsoft.ML.Probabilistic.Utilities
    Assembly: Microsoft.ML.Probabilistic.dll
    Syntax
    public static class StringUtil

    Methods

    AppendParameters(StringBuilder, IEnumerable<ParameterInfo>, Boolean)

    Declaration
    public static void AppendParameters(StringBuilder s, IEnumerable<ParameterInfo> parameters, bool omitParameterNames = false)
    Parameters
    Type Name Description
    StringBuilder s
    IEnumerable<ParameterInfo> parameters
    Boolean omitParameterNames

    AppendTypes(StringBuilder, Type[])

    Append type strings to a StringBuilder

    Declaration
    public static void AppendTypes(StringBuilder s, Type[] types)
    Parameters
    Type Name Description
    StringBuilder s
    Type[] types

    AppendTypes(StringBuilder, Type[], Boolean, Set<Type>)

    Append type strings to a StringBuilder

    Declaration
    public static void AppendTypes(StringBuilder s, Type[] types, bool showConstraints, Set<Type> constrained)
    Parameters
    Type Name Description
    StringBuilder s
    Type[] types
    Boolean showConstraints
    Set<Type> constrained

    AppendXmlTypes(StringBuilder, Type[])

    Declaration
    public static void AppendXmlTypes(StringBuilder s, Type[] types)
    Parameters
    Type Name Description
    StringBuilder s
    Type[] types

    ArrayDimensions(Array)

    Declaration
    public static int[] ArrayDimensions(Array a)
    Parameters
    Type Name Description
    Array a
    Returns
    Type Description
    Int32[]

    ArrayLengths(ICollection<Array>)

    Declaration
    public static ICollection<int> ArrayLengths(ICollection<Array> arrayList)
    Parameters
    Type Name Description
    ICollection<Array> arrayList
    Returns
    Type Description
    ICollection<Int32>

    ArrayLowerBounds(Array)

    Declaration
    public static int[] ArrayLowerBounds(Array a)
    Parameters
    Type Name Description
    Array a
    Returns
    Type Description
    Int32[]

    ArrayLowerBounds(Array, out Boolean)

    Declaration
    public static int[] ArrayLowerBounds(Array a, out bool allZero)
    Parameters
    Type Name Description
    Array a
    Boolean allZero
    Returns
    Type Description
    Int32[]

    ArrayStrides(IList<Int32>)

    Declaration
    public static int[] ArrayStrides(IList<int> dims)
    Parameters
    Type Name Description
    IList<Int32> dims
    Returns
    Type Description
    Int32[]

    ArrayToString(Array)

    Get a string listing all elements of an array on a separate line

    Declaration
    public static string ArrayToString(Array a)
    Parameters
    Type Name Description
    Array a
    Returns
    Type Description
    String

    ArrayToString(IEnumerable, Int32[], Int32[])

    Get a string listing all elements of an array, one per line

    Declaration
    public static string ArrayToString(IEnumerable a, int[] strides, int[] lowerBounds)
    Parameters
    Type Name Description
    IEnumerable a
    Int32[] strides
    Int32[] lowerBounds
    Returns
    Type Description
    String

    CollectionToString<T>(IEnumerable<T>, String)

    Get a string of list elements separated by a delimiter

    Declaration
    public static string CollectionToString<T>(IEnumerable<T> list, string delimiter)
    Parameters
    Type Name Description
    IEnumerable<T> list
    String delimiter
    Returns
    Type Description
    String
    Type Parameters
    Name Description
    T

    DictionaryToString(IDictionary, String)

    Get a string listing the entries of a dictionary, one per line.

    Declaration
    public static string DictionaryToString(IDictionary dict, string delimiter)
    Parameters
    Type Name Description
    IDictionary dict
    String delimiter
    Returns
    Type Description
    String

    DictionaryToString<KeyType, ValueType>(IEnumerable<KeyValuePair<KeyType, ValueType>>, String)

    Get a string listing the entries of a dictionary, one per line.

    Declaration
    public static string DictionaryToString<KeyType, ValueType>(IEnumerable<KeyValuePair<KeyType, ValueType>> dict, string delimiter)
    Parameters
    Type Name Description
    IEnumerable<KeyValuePair<KeyType, ValueType>> dict
    String delimiter
    Returns
    Type Description
    String
    Type Parameters
    Name Description
    KeyType
    ValueType

    EnumerableToString(IEnumerable, String)

    Get a string listing the elements of an enumerable, one per line.

    Declaration
    public static string EnumerableToString(IEnumerable a, string delimiter)
    Parameters
    Type Name Description
    IEnumerable a
    String delimiter
    Returns
    Type Description
    String

    EscapeXmlCharacters(String)

    Get a string of the form "typeName.methodName&lt;types&gt;", suitable for use as an XML element value.

    Declaration
    public static string EscapeXmlCharacters(string text)
    Parameters
    Type Name Description
    String text

    A string.

    Returns
    Type Description
    String

    A valid XML element value.

    GenericParameterAttributesToString(GenericParameterAttributes)

    Declaration
    public static string GenericParameterAttributesToString(GenericParameterAttributes attributes)
    Parameters
    Type Name Description
    GenericParameterAttributes attributes
    Returns
    Type Description
    String

    IndexerToString(Object, String)

    Get a string listing the elements of an indexable object, one per line

    Declaration
    public static string IndexerToString(object o, string delimiter)
    Parameters
    Type Name Description
    Object o
    String delimiter
    Returns
    Type Description
    String

    IsIndexable(Object)

    Declaration
    public static bool IsIndexable(object o)
    Parameters
    Type Name Description
    Object o
    Returns
    Type Description
    Boolean

    JoinColumns(Object[])

    Declaration
    public static string JoinColumns(params object[] columns)
    Parameters
    Type Name Description
    Object[] columns
    Returns
    Type Description
    String

    JoinColumns(String[][])

    Create a string denoting a multi-line table with multiple columns.

    Declaration
    public static string JoinColumns(params string[][] lines)
    Parameters
    Type Name Description
    String[][] lines

    lines[column][line] is a single text line in the column.

    Returns
    Type Description
    String

    LinearIndexToMultidimensionalIndex(Int32, Int32[], Int32[])

    Declaration
    public static void LinearIndexToMultidimensionalIndex(int index, int[] strides, int[] mIndex)
    Parameters
    Type Name Description
    Int32 index
    Int32[] strides
    Int32[] mIndex

    LinearIndexToMultidimensionalIndex(Int32, Int32[], Int32[], Int32[])

    Declaration
    public static void LinearIndexToMultidimensionalIndex(int index, int[] strides, int[] mIndex, int[] lowerBounds)
    Parameters
    Type Name Description
    Int32 index
    Int32[] strides
    Int32[] mIndex
    Int32[] lowerBounds

    Lines(String)

    Declaration
    public static string[] Lines(string text)
    Parameters
    Type Name Description
    String text
    Returns
    Type Description
    String[]

    Max(ICollection<Int32>)

    Declaration
    public static int Max(ICollection<int> list)
    Parameters
    Type Name Description
    ICollection<Int32> list
    Returns
    Type Description
    Int32

    MethodFullNameToString(MethodBase)

    Get a string of the form "typeName.methodName<types>".

    Declaration
    public static string MethodFullNameToString(MethodBase method)
    Parameters
    Type Name Description
    MethodBase method
    Returns
    Type Description
    String

    MethodNameToString(MethodBase)

    Get a string of the form "methodName<types>"

    Declaration
    public static string MethodNameToString(MethodBase method)
    Parameters
    Type Name Description
    MethodBase method
    Returns
    Type Description
    String

    MethodSignatureToString(MethodInfo, Boolean, Boolean)

    Get a short string describing the signature of a method.

    Declaration
    public static string MethodSignatureToString(MethodInfo method, bool useFullName = true, bool omitParameterNames = false)
    Parameters
    Type Name Description
    MethodInfo method

    The method to get the signature for.

    Boolean useFullName

    Specifies whether the name of the method should be prepended with the name of the class.

    Boolean omitParameterNames

    Specifies whether the parameter names should be omitted from the result.

    Returns
    Type Description
    String

    A string of the form "methodName<types>(parameters)"

    Remarks

    From the C# 3.0 specification sec 1.6.6: The signature of a method consists of the name of the method, the number of type parameters and the number, modifiers, and types of its parameters. The signature of a method does not include the return type.

    MultidimensionalIndexToLinearIndex(Int32[], Int32[])

    Declaration
    public static int MultidimensionalIndexToLinearIndex(int[] index, int[] strides)
    Parameters
    Type Name Description
    Int32[] index
    Int32[] strides
    Returns
    Type Description
    Int32

    PropertiesToString(Object, String, String)

    Declaration
    public static string PropertiesToString(object o, string delimiter, string initial)
    Parameters
    Type Name Description
    Object o
    String delimiter
    String initial
    Returns
    Type Description
    String

    SetToArrayStrides(IList<Int32>, IList<Int32>, Int32)

    Declaration
    public static void SetToArrayStrides(IList<int> strides, IList<int> dims, int baseStride)
    Parameters
    Type Name Description
    IList<Int32> strides
    IList<Int32> dims
    Int32 baseStride

    StringLengths(ICollection<String>)

    Declaration
    public static ICollection<int> StringLengths(ICollection<string> stringList)
    Parameters
    Type Name Description
    ICollection<String> stringList
    Returns
    Type Description
    ICollection<Int32>

    Sum(ICollection<Boolean>)

    Declaration
    public static int Sum(ICollection<bool> list)
    Parameters
    Type Name Description
    ICollection<Boolean> list
    Returns
    Type Description
    Int32

    ToString(Object)

    Get a verbose string describing an object, or invoke the object's custom ToString method if it exists

    Declaration
    public static string ToString(object o)
    Parameters
    Type Name Description
    Object o
    Returns
    Type Description
    String

    TypeToString(Type)

    Get a C# style string describing a .NET type.

    Declaration
    public static string TypeToString(Type type)
    Parameters
    Type Name Description
    Type type
    Returns
    Type Description
    String

    TypeToString(Type, Boolean)

    Declaration
    public static string TypeToString(Type type, bool showConstraints)
    Parameters
    Type Name Description
    Type type
    Boolean showConstraints
    Returns
    Type Description
    String

    TypeToString(Type, Boolean, Set<Type>)

    Declaration
    public static string TypeToString(Type type, bool showConstraints, Set<Type> constrained)
    Parameters
    Type Name Description
    Type type
    Boolean showConstraints
    Set<Type> constrained
    Returns
    Type Description
    String

    TypeToXmlString(Type)

    Declaration
    public static string TypeToXmlString(Type type)
    Parameters
    Type Name Description
    Type type
    Returns
    Type Description
    String

    VerboseToString(Object)

    Get a string describing the contents of an object by enumerating its items and properties.

    Declaration
    public static string VerboseToString(object o)
    Parameters
    Type Name Description
    Object o
    Returns
    Type Description
    String
    In This Article
    Back to top Copyright © .NET Foundation. All rights reserved.