In a C# 2008 desktop application, I want to obtain data that is part of the file name. I want to obtain the following:
1. Data that is the first character to where the first '_' is located,
2. data from the first '_' to the second '_'.
Thus can you tell me how to code the above using C#.net 2008?
C# obtain data from filename
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

VulpesRank #55 · 29.2K reputationPosted Dec 19, 2012, 5:07 AM EST
string[] items = fileName.Split('_');
items[0] will be the portion to the first _ and then items[1] will be the portion from the first _ to the second _.
These will exclude the underscores themselves.
VulpesRank #55 · 29.2K reputationPosted Dec 19, 2012, 5:39 AM EST