I've been doing a task for an interview that I will have soon.
The requirement is to code the following problem in C#.

> 
> Write a program (and prove that it works) that: Given a text file, count the occurrence of each unique word in the file.
>  For example; a file containing the string “Go do that thing that you do so well” should find these counts:
>  1: Go
>  2: do
>  2: that
>  1: thing
>  1: you
>  1: so
>  1: well
> 
> 
> 

I coded my solution and it's working fine for the tests I gave.

I'm looking for any ways that I can improve my code and to get feedback on the solution. Is there's any way I could to the problem more efficiently.

Thank you in advance.

```
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;

namespace CountOccurrence
{
    class Program
    {
        static void Main(string[] args)
        {
            string text = System.IO.File.ReadAllText(@"F:\Ex\Myfile.txt");              // User ReadAllText to copy the file's text into a string
            string textToLower = text.ToLower();                                        // Converts the string to lower case string
            Regex reg_exp = new Regex("[^a-z0-9]");                                     // Regular expressions to replace non-letter and non-number characters with spaces. It uses the pattern [^a-z0-9].The a-z0-9 part means any lowercase letter or a digit.
            textToLower = reg_exp.Replace(textToLower, " ");                            // The code uses the Regex object’s Replace method to replace the characters that match the pattern with a space character. 
            string[] Value = textToLower.Split(new char[] {' '},
            StringSplitOptions.RemoveEmptyEntries);                                     // Split the string and remove the empty entries

            Dictionary<string, int> CountTheOccurrences = new Dictionary<string, int>(); // Create a dictionary to keep track of each occurrence of the words in the string
            for (int i = 0; i < Value.Length; i++)                                       // Loop the splited string  
            {
                if (CountTheOccurrences.ContainsKey(Value[i]))                           // Check if word is already in dictionary update the count  
                {
                    int value = CountTheOccurrences[Value[i]];
                    CountTheOccurrences[Value[i]] = value + 1;
                }
                else                                                                     // If we found the same word we just increase the count in the dictionary 
                {
                    CountTheOccurrences.Add(Value[i], 1);  
                }
            }

            Console.WriteLine("The number of counts for each words are:");
            foreach (KeyValuePair<string, int> kvp in CountTheOccurrences)
            {
                Console.WriteLine("Counts: " + kvp.Value + " for " + kvp.Key);           // Print the number of counts for each word
            }
            Console.ReadKey();
        }
    }
}

```