Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next 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 ​CombineAfterIndex(string[] InputArr, string Glue, int StartIdx) ===
 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:
 } }
 </​code>​ </​code>​
 +
 +=== List<​string>​ Parameterize(string Parameters) ===
 +
 <code c#> <code c#>
 public static List<​string>​ Parameterize(string Parameters) { public static List<​string>​ Parameterize(string Parameters) {
Line 36: Line 39:
 } }
 </​code>​ </​code>​
 +
 +=== int OccurrencesInString(String Haystack, String Needle) ===
 +Counts the number of occurrences of Needle in Haystack.
 <code c#> <code c#>
 /// <​summary>​ /// <​summary>​
-/// Counts the number of occurances ​of Needle in Haystack.+/// Counts the number of occurrences ​of Needle in Haystack.
 /// </​summary>​ /// </​summary>​
 /// <param name="​Haystack">​String being search</​param>​ /// <param name="​Haystack">​String being search</​param>​
 /// <param name="​Needle">​String being searched for</​param>​ /// <param name="​Needle">​String being searched for</​param>​
 /// <​returns>​Integer representing the number of occurances of Needle in Haystack</​returns>​ /// <​returns>​Integer representing the number of occurances of Needle in Haystack</​returns>​
-public static int OccurancesInString(String Haystack, String Needle) {+public static int OccurrencesInString(String Haystack, String Needle) {
  return Regex.Matches(Haystack,​ Needle).Count;​  return Regex.Matches(Haystack,​ Needle).Count;​
 } }
 </​code>​ </​code>​
  
 +=== void PrintArrayList(ArrayList InputArray) ===
 +Prints an ArrayList object to the console.
 <code c#> <code c#>
 /// <​summary>​ /// <​summary>​
Line 61: Line 69:
 </​code>​ </​code>​
  
 +=== void DumpByteArrayToFile(byte[] inputBytes, String FileName) ===
 +Dumps a byte[] Array to a file.
 <code c#> <code c#>
 /// <​summary>​ /// <​summary>​
Line 77: Line 87:
 </​code>​ </​code>​
  
 +=== void DumpStringToFile(String inputString,​ String FileName) ===
 +Dumps a String to a file.
 <code c#> <code c#>
 /// <​summary>​ /// <​summary>​
Line 93: Line 105:
 </​code>​ </​code>​
  
 +=== 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#>
 /// <​summary>​ /// <​summary>​
Line 107: Line 121:
 </​code>​ </​code>​
  
 +=== 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#>
 /// <​summary>​ /// <​summary>​
Line 122: Line 138:
 </​code>​ </​code>​
  
 +=== 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#>
 /// <​summary>​ /// <​summary>​
Line 136: Line 154:
 } }
 </​code>​ </​code>​
 +
 +=== ByteArrToASCII(byte[] inputByteArr) ===
  
 <code c#> <code c#>
Line 148: Line 168:
 } }
 </​code>​ </​code>​
 +
 +=== String RemoveNewLineChars(String inputStr) ===
  
 <code c#> <code c#>
Line 162: Line 184:
 } }
 </​code>​ </​code>​
 +
 +=== String StringArrToDelimitedStr(String[] inputStrArr,​ String Delimiter) ===
  
 <code c#> <code c#>
Line 181: Line 205:
 } }
 </​code>​ </​code>​
 +
 +=== String BytesToHumanReadable(long Bytes, int Accuracy) ===
  
 <code c#> <code c#>
Line 199: Line 225:
 } }
 </​code>​ </​code>​
 +
 +=== String MillisecondsToClockFormat(double Milliseconds) ===
  
 <code c#> <code c#>
Line 215: Line 243:
 } }
 </​code>​ </​code>​
 +
 +=== String MillisecondsToHumanReadable(double Milliseconds) ===
  
 <code c#> <code c#>
code_snippets/csharp_snippets.1403028971.txt.gz · Last modified: 2014/06/17 18:16 by smark
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0