Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
code_snippets:csharp_snippets [2014/06/17 18:16] – smark | code_snippets:csharp_snippets [2014/06/19 16:19] (current) – smark | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== C# Snippets ====== | ====== C# Snippets ====== | ||
- | === CombineAfterIndex(string[] InputArr, string Glue, int StartIdx) === | + | === string |
Combine elements of a string array with a string between them, after an index from the first array | Combine elements of a string array with a string between them, after an index from the first array | ||
<code c#> | <code c#> | ||
Line 12: | Line 12: | ||
} | } | ||
</ | </ | ||
+ | |||
+ | === List< | ||
+ | |||
<code c#> | <code c#> | ||
public static List< | public static List< | ||
Line 36: | Line 39: | ||
} | } | ||
</ | </ | ||
+ | |||
+ | === int OccurrencesInString(String Haystack, String Needle) === | ||
+ | Counts the number of occurrences of Needle in Haystack. | ||
<code c#> | <code c#> | ||
/// < | /// < | ||
- | /// Counts the number of occurances | + | /// Counts the number of occurrences |
/// </ | /// </ | ||
/// <param name=" | /// <param name=" | ||
/// <param name=" | /// <param name=" | ||
/// < | /// < | ||
- | public static int OccurancesInString(String Haystack, String Needle) { | + | public static int OccurrencesInString(String Haystack, String Needle) { |
return Regex.Matches(Haystack, | return Regex.Matches(Haystack, | ||
} | } | ||
</ | </ | ||
+ | === void PrintArrayList(ArrayList InputArray) === | ||
+ | Prints an ArrayList object to the console. | ||
<code c#> | <code c#> | ||
/// < | /// < | ||
Line 61: | Line 69: | ||
</ | </ | ||
+ | === void DumpByteArrayToFile(byte[] inputBytes, String FileName) === | ||
+ | Dumps a byte[] Array to a file. | ||
<code c#> | <code c#> | ||
/// < | /// < | ||
Line 77: | Line 87: | ||
</ | </ | ||
+ | === void DumpStringToFile(String inputString, | ||
+ | Dumps a String to a file. | ||
<code c#> | <code c#> | ||
/// < | /// < | ||
Line 93: | Line 105: | ||
</ | </ | ||
+ | === void PrintCharArrASCII(char[] inputCharArr) === | ||
+ | Prints the ASCII values of every character in a character array delimited by a pipe character to the Console. | ||
<code c#> | <code c#> | ||
/// < | /// < | ||
Line 107: | Line 121: | ||
</ | </ | ||
+ | === void PrintStringASCII(String inputStr) === | ||
+ | Prints the ASCII values of every character in a string delimited by a pipe character to the Console. | ||
<code c#> | <code c#> | ||
/// < | /// < | ||
Line 122: | Line 138: | ||
</ | </ | ||
+ | === void PrintByteArrASCII(byte[] inputByteArr) === | ||
+ | Prints the ASCII values of every character in a character array delimited by a pipe character to the Console. | ||
<code c#> | <code c#> | ||
/// < | /// < | ||
Line 136: | Line 154: | ||
} | } | ||
</ | </ | ||
+ | |||
+ | === ByteArrToASCII(byte[] inputByteArr) === | ||
<code c#> | <code c#> | ||
Line 148: | Line 168: | ||
} | } | ||
</ | </ | ||
+ | |||
+ | === String RemoveNewLineChars(String inputStr) === | ||
<code c#> | <code c#> | ||
Line 162: | Line 184: | ||
} | } | ||
</ | </ | ||
+ | |||
+ | === String StringArrToDelimitedStr(String[] inputStrArr, | ||
<code c#> | <code c#> | ||
Line 181: | Line 205: | ||
} | } | ||
</ | </ | ||
+ | |||
+ | === String BytesToHumanReadable(long Bytes, int Accuracy) === | ||
<code c#> | <code c#> | ||
Line 199: | Line 225: | ||
} | } | ||
</ | </ | ||
+ | |||
+ | === String MillisecondsToClockFormat(double Milliseconds) === | ||
<code c#> | <code c#> | ||
Line 215: | Line 243: | ||
} | } | ||
</ | </ | ||
+ | |||
+ | === String MillisecondsToHumanReadable(double Milliseconds) === | ||
<code c#> | <code c#> |