I am using file helpers and I put on top of my class [DelimitedRecord("|")]
I want to check though if the value is a "|" if not then I want to throw an exception..
public void WriteResults<T>(IList<T> resultsToWrite, string path, string fileName) where T: class
{
var attr = (DelimitedRecordAttribute)Attribute.GetCustomAttribute(typeof(T), typeof(DelimitedRecordAttribute));
if (attr.HasValue("|")) // has value does not exist.
{
FileHelperEngine<T> engine = new FileHelperEngine<T>();
engine.HeaderText = String.Join("|", typeof(T).GetFields().Select(x => x.Name));
string fullPath = String.Format(@"{0}\{1}-{2}.csv", path, fileName, DateTime.Now.ToString("yyyy-MM-dd"));
engine.WriteFile(fullPath, resultsToWrite);
}
}
What can I use to check for that attribute is on the class with that value?
Edit
This is what I see as available properties