Hello,
I'm a complete newbie to linq.
I'm trying to figure out how to get an array of objects out of another array of objects filtering by distinct fields.
The source array consists of instances of a clsFileRecord class. It has these fields:
bool Exists;
string FolderPath;
string FileName;
string FileSize;
I want to filter the source array by FolderPath. I want to grab the instances of the clsFileRecord for which the FolderPath is unique. In other words, as I iterate through the source array, if I haven't yet encountered a clsFileRecord whose Folder path is "x/y/z", then added to the destination array. If I have already encountered a clsFileRecord whose Folder path is "x/y/z", ignore it.
In the end, each clsFileRecord in the destination array should have a unique FolderPath. I'm not worried about different FileNames as that field is going to be ignored in the destination array.
Can someone please help me work out a linq statement that will accomplish this? Thank you very much.
I'm a complete newbie to linq.
I'm trying to figure out how to get an array of objects out of another array of objects filtering by distinct fields.
The source array consists of instances of a clsFileRecord class. It has these fields:
bool Exists;
string FolderPath;
string FileName;
string FileSize;
I want to filter the source array by FolderPath. I want to grab the instances of the clsFileRecord for which the FolderPath is unique. In other words, as I iterate through the source array, if I haven't yet encountered a clsFileRecord whose Folder path is "x/y/z", then added to the destination array. If I have already encountered a clsFileRecord whose Folder path is "x/y/z", ignore it.
In the end, each clsFileRecord in the destination array should have a unique FolderPath. I'm not worried about different FileNames as that field is going to be ignored in the destination array.
Can someone please help me work out a linq statement that will accomplish this? Thank you very much.