Class StringUtil
Helpful methods for converting objects to strings.
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
AppendTypes(StringBuilder, Type[])
Append type strings to a StringBuilder
Declaration
public static void AppendTypes(StringBuilder s, Type[] types)
Parameters
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
AppendXmlTypes(StringBuilder, Type[])
Declaration
public static void AppendXmlTypes(StringBuilder s, Type[] types)
Parameters
ArrayDimensions(Array)
Declaration
public static int[] ArrayDimensions(Array a)
Parameters
Type |
Name |
Description |
Array |
a |
|
Returns
ArrayLengths(ICollection<Array>)
Declaration
public static ICollection<int> ArrayLengths(ICollection<Array> arrayList)
Parameters
Returns
ArrayLowerBounds(Array)
Declaration
public static int[] ArrayLowerBounds(Array a)
Parameters
Type |
Name |
Description |
Array |
a |
|
Returns
ArrayLowerBounds(Array, out Boolean)
Declaration
public static int[] ArrayLowerBounds(Array a, out bool allZero)
Parameters
Returns
ArrayStrides(IList<Int32>)
Declaration
public static int[] ArrayStrides(IList<int> dims)
Parameters
Returns
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
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
Returns
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
Returns
Type Parameters
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
Returns
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
Returns
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
Returns
EscapeXmlCharacters(String)
Get a string of the form "typeName.methodName<types>", 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
Returns
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
Returns
IsIndexable(Object)
Declaration
public static bool IsIndexable(object o)
Parameters
Type |
Name |
Description |
Object |
o |
|
Returns
JoinColumns(Object[])
Declaration
public static string JoinColumns(params object[] columns)
Parameters
Type |
Name |
Description |
Object[] |
columns |
|
Returns
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
LinearIndexToMultidimensionalIndex(Int32, Int32[], Int32[])
Declaration
public static void LinearIndexToMultidimensionalIndex(int index, int[] strides, int[] mIndex)
Parameters
LinearIndexToMultidimensionalIndex(Int32, Int32[], Int32[], Int32[])
Declaration
public static void LinearIndexToMultidimensionalIndex(int index, int[] strides, int[] mIndex, int[] lowerBounds)
Parameters
Lines(String)
Declaration
public static string[] Lines(string text)
Parameters
Type |
Name |
Description |
String |
text |
|
Returns
Max(ICollection<Int32>)
Declaration
public static int Max(ICollection<int> list)
Parameters
Returns
MethodFullNameToString(MethodBase)
Get a string of the form "typeName.methodName<types>".
Declaration
public static string MethodFullNameToString(MethodBase method)
Parameters
Returns
MethodNameToString(MethodBase)
Get a string of the form "methodName<types>"
Declaration
public static string MethodNameToString(MethodBase method)
Parameters
Returns
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)"
|
MultidimensionalIndexToLinearIndex(Int32[], Int32[])
Declaration
public static int MultidimensionalIndexToLinearIndex(int[] index, int[] strides)
Parameters
Type |
Name |
Description |
Int32[] |
index |
|
Int32[] |
strides |
|
Returns
PropertiesToString(Object, String, String)
Declaration
public static string PropertiesToString(object o, string delimiter, string initial)
Parameters
Returns
SetToArrayStrides(IList<Int32>, IList<Int32>, Int32)
Declaration
public static void SetToArrayStrides(IList<int> strides, IList<int> dims, int baseStride)
Parameters
StringLengths(ICollection<String>)
Declaration
public static ICollection<int> StringLengths(ICollection<string> stringList)
Parameters
Returns
Sum(ICollection<Boolean>)
Declaration
public static int Sum(ICollection<bool> list)
Parameters
Returns
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
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
TypeToString(Type, Boolean)
Declaration
public static string TypeToString(Type type, bool showConstraints)
Parameters
Type |
Name |
Description |
Type |
type |
|
Boolean |
showConstraints |
|
Returns
TypeToString(Type, Boolean, Set<Type>)
Declaration
public static string TypeToString(Type type, bool showConstraints, Set<Type> constrained)
Parameters
Returns
TypeToXmlString(Type)
Declaration
public static string TypeToXmlString(Type type)
Parameters
Type |
Name |
Description |
Type |
type |
|
Returns
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