[CSVTable]
public class Course {
[CSVColumn("Course")]
public string CourseName { get; set; }
[CSVColumn("Name")]
public string Teacher { get; set; }
[CSVColumn("Date")]
public DateTime CreatedTime { get; set; }
}
JsonConvert.SerializeObject(new Course() { CourseName = "Course", Teacher = "One", CreatedTime = DateTime.Now });
выбросить исключение FileNotFoundException о dll «System.Runtime, Version = 4.2.2.0, Culture = нейтральный, PublicKeyToken = b03f5f7f11d50a3a», не загруженном в методе «JsonConvert.SerializeObject»
о CSVTable и CSVColumn:
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = true, Inherited = false)]
public class CSVColumnAttribute : Attribute, IComparable<CSVColumnAttribute> {
public string HeaderText { get; set; }
public int Order { get; set; }
public string TableName { get; set; } = "default";
public CSVColumnAttribute(string Header) { HeaderText = Header; }
public int CompareTo([AllowNull] CSVColumnAttribute other) {
return other == null ? 0 : Order.CompareTo(other.Order);
}
}
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = true, Inherited = false)]
public class CSVTableAttribute : Attribute {
public string Name { get; set; } = "default";
public char JoinChar { get; set; } = ',';
}