Drag Drop, get filename and last 23 characters I want to get the filename and last 23 characters when I drag into a textbox.

I have it working, but I would like to just have one line.  Currently, I think I am doing a bit of a workaround. As I must use a string array, and I only want one string, so I don't really need an array.

private void First_DragDrop(object sender, DragEventArgs e)
{
    string[] fileList = e.Data.GetData(DataFormats.FileDrop) as string[];
    string filename = Path.GetFileNameWithoutExtension(fileList[0]);
    First.Text = filename.Substring(filename.Length - 23, 23);
}


As you can see, I must do it in 3 steps. First, get the string array.  Then, get one string from that array and turn it into a filename.  FInally, I need to get the last 23 characters of that string.

I think I should be able to just get everything immediately. Though maybe it's not possible?  It just seems weird that I must use an array that contains one thing.
Yes, you can write everything in one line, but you will not be happy with the result. And no, .Net creators did not think of implementing a single call which would return exactly 23 characters of dropped file name. :) Silly them. :) 

Meanwhile, your code makes sense. I see only two possible issues:


You do not handle multiple files being dropped (that is why there is an array)
You do not handle fileList being null.