Skip to content

Instantly share code, notes, and snippets.

@wattanar
Last active October 31, 2017 14:51
Show Gist options
  • Select an option

  • Save wattanar/d18c907bec9f370c12e80133c17f3a6b to your computer and use it in GitHub Desktop.

Select an option

Save wattanar/d18c907bec9f370c12e80133c17f3a6b to your computer and use it in GitHub Desktop.
.NET Core Snippets
  • Get files from directory
string[] filePaths = Directory.GetFiles(@"C:\path\to\file");

foreach (var item in filePaths)
{
    Console.WriteLine(item);
}
  • Hex to Ascii
private string HexString2Ascii(string hexString)
{
    StringBuilder sb = new StringBuilder();
    for (int i = 0; i <= hexString.Length - 2; i += 2)
    {
        sb.Append(Convert.ToString(Convert.ToChar(Int32.Parse(hexString.Substring(i, 2), System.Globalization.NumberStyles.HexNumber))));
    }
    return sb.ToString();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment