Q:

Substring file path

Hi I'm trying to substring a file path before it goes into a dictionary. I've tried to declare the start point but am given an error:
StartIndex cannot be larger than length of string. Parameter name: startIndex
This is my code 
private  Dictionary<string,int> CreateDictionary(log logInstance)
        {
            Dictionary<string, int> dictionary = new Dictionary<string, int>();
            for (int entryIdex = 0; entryIdex < logInstance.logentry.Count(); entryIdex++)
            {
                logLogentry entry = logInstance.logentry[entryIdex];
                for (int pathIdex = 0; pathIdex < entry.paths.Count(); pathIdex++)
                {
                    logLogentryPath path = entry.paths[pathIdex];
                    string filePath = path.Value;
                    filePath.Substring(63);
                    string cutPath = filePath;
                    if (dictionary.ContainsKey(cutPath))
                    {
                        dictionary[cutPath]++;
                    }
                    else
                    {
                        dictionary.Add(cutPath, 1);
                    }
                }
            }
            return dictionary;
        }

Any help would be great. 
I've also tried doing
filePath.Substring(0, 63);

and
filePath.Substring(63, length);

A:

Strings in C# are immutable (once a string is created it cannot be modified), this means that when you set string cutpath = filepath you are setting the value of cutpath to path.Value as you haven't assigned the value of filepath.SubString(63) to anything. To fix this change
string filePath = path.Value;
filePath.Substring(63); // here is the problem
string cutPath = filePath;

To
string filePath = path.Value;
string cutPath = filePath.Substring(63);

