FileHelper 属性仅限于 fields/members
FileHelper attributes limitied to fields/members only
我在表单中使用 FieldQuoted 属性 class。我注意到我不能把这个属性放在属性上。它只允许 members/fields。是否有一个原因?这可以扩展以允许属性吗?
我问的原因是我在其他属性友好但对成员不友好的地方使用这个class(例如MVC模型活页夹)。
根据Allow Properties instead of fields #67
Yes the library started with fields in 2004 mostly because if you
support properties you must to ensure that are writable, can throw
errors, can slow down assignment with custom code, also the reflection
of .net 1.1 were incredible slow and dynamic code generation for
fields was easy to implement
Later for backward compatibility and lazyness I didn't support
properties, now autoproperties work better thanks to work in this PR
#170
But we must to do the effort and support full properties and try to
make a little impact in the previous code to avoid weird errors, maybe
with new record classes
似乎对 Autoproperties full support #170 进行了一些更改,但这尚未包含在发布中。它似乎只在 master 分支上可用。
I will be merging this but later I will change the way it works to
avoid use of both autoproperties and fields and also to allow
properties in the general way, but your implementation make the use of
autoproperties a simple task
如果您对使用它不满意,我建议您只为 import/export 创建一个单独的 class 来反映您现有的 class 但使用字段,如建议的那样Formatting properties with FileHelper 的公认答案。在他们被释放之前,可能是目前最安全的选择。
我在表单中使用 FieldQuoted 属性 class。我注意到我不能把这个属性放在属性上。它只允许 members/fields。是否有一个原因?这可以扩展以允许属性吗?
我问的原因是我在其他属性友好但对成员不友好的地方使用这个class(例如MVC模型活页夹)。
根据Allow Properties instead of fields #67
Yes the library started with fields in 2004 mostly because if you support properties you must to ensure that are writable, can throw errors, can slow down assignment with custom code, also the reflection of .net 1.1 were incredible slow and dynamic code generation for fields was easy to implement
Later for backward compatibility and lazyness I didn't support properties, now autoproperties work better thanks to work in this PR #170
But we must to do the effort and support full properties and try to make a little impact in the previous code to avoid weird errors, maybe with new record classes
似乎对 Autoproperties full support #170 进行了一些更改,但这尚未包含在发布中。它似乎只在 master 分支上可用。
I will be merging this but later I will change the way it works to avoid use of both autoproperties and fields and also to allow properties in the general way, but your implementation make the use of autoproperties a simple task
如果您对使用它不满意,我建议您只为 import/export 创建一个单独的 class 来反映您现有的 class 但使用字段,如建议的那样Formatting properties with FileHelper 的公认答案。在他们被释放之前,可能是目前最安全的选择。