FileHelpers icon indicating copy to clipboard operation
FileHelpers copied to clipboard

Allow FieldHidden when using Autoproperties

Open OldNo7 opened this issue 9 years ago • 2 comments

Currently most of the attributes only work on fields. I need to ignore a property in my class when reading a file. The property is an autoproperty.

[DelimitedRecord( "," )]
class A {
  [FieldHidden] //this throws an error because SomeProp is not a field
  public int SomeProp { get; set; }
  public int OtherProp { get; set; }
  public int LastProp { get; set; }
}

I tried just adding Property to the AttributeUsage but it still didn't ignore the property and threw an exception because there were more fields in the class than in the CSV

OldNo7 avatar Sep 25 '15 23:09 OldNo7

+1

maxigs7 avatar Dec 11 '15 19:12 maxigs7

This seems to be done here : https://github.com/MarcosMeli/FileHelpers/commit/c6cd0f20607f7de33145115efdebcc68969484b9

Are you going to create a new release including at least these change on FieldHidden for properties ?

guillaumejay avatar Sep 07 '16 07:09 guillaumejay