Skip to content

Instantly share code, notes, and snippets.

View Sheepings's full-sized avatar
🎯
Focusing

Sheepings Sheepings

🎯
Focusing
  • UK
View GitHub Profile
@Sheepings
Sheepings / ReadFileContentsToList.cs
Last active November 27, 2019 00:31
Using the textfieldparser to read a files contents to a list string array
public static readonly string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "mytext.txt");
public static List<string[]> IEnum = new List<string[]>();
private void Button1_Click(object sender, EventArgs e)
{
using (FileStream reader = File.OpenRead(path))
using (TextFieldParser iParse = new TextFieldParser(reader))
{
iParse.Delimiters = new[] { "," }; iParse.HasFieldsEnclosedInQuotes = true;
do
@Sheepings
Sheepings / MultithreadingTemplate.cs
Created November 10, 2019 01:53
This is a basic multithreading template which demonstrates how to update your UI from a non UI thread
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Shown(object sender, EventArgs e)
{
void updateUI()
{
@Sheepings
Sheepings / BidiConcatHelper.cs
Last active November 10, 2019 01:41
This helper class concatenates numbers and letters and aligns Hebrew/Arabic between numbers.
public static string GetHebrewConcat(char[] charRange, string codeToPoint, Tuple<string, string, string> tupleOfStrings, string separator)
{
string[] col_OfConcatValues = { };
var charArr = tupleOfStrings.Item2.ToCharArray();
int spins = 0;
foreach (char eChar in charArr)
{
switch (HasHebrew(eChar, false, false, charRange))
{
case true: