I've got an issue with changing attribute at runtime.
I'm using https://www.filehelpers.net/ to handle csv but I think this problem is similar for any other custom attributes.
There is a class representing entity:
[DelimitedRecord("\t")]
public class FileHelper
{
[FieldNotEmpty]
public string Id = "1";
public string Name = "Product1"
}
This class is used as generic parameter for file reading engine. What I want to do is to change DelimitedRecord("\t") to a runtime value eg. semicolon .
I know that I can use below code to get attributes but only read.
DelimitedRecordAttribute[] attributes = (DelimitedRecordAttribute[]) typeof(FileHelper).GetCustomAttributes(typeof(DelimitedRecordAttribute), false);
Is there option to change attribute value or remove it and add new attribute new value?
Aucun commentaire:
Enregistrer un commentaire