Search code examples
c#.netfilehelpers

FieldOptional FileHelpers Must be Marked as Optional Because the Previous Field is Marked as Optional


I am using filehelpers 2.9.9 and trying to use FiledOptional but I keep getting this error

The field: SystemUrl must be marked as optional because the previous field is marked as optional. (Try adding [FieldOptional] to SystemUrl)

SystemUrl is the first field and I marked it FieldOptional. Does every other field after it need to marked as Optional Too?


Solution

  • SystemUrl is the first field and I marked it FieldOptional. Does every other field after it need to marked as Optional Too?

    Yes. Once you mark a field as optional, all subsequent fields must also be optional.

    If you don't want this behavior, you'll need to move SystemUrl to the end, not have it first.