Как я могу проигнорировать свойство при сериализации использования DataContractSerializer?

Относительно проблемы запястья, я изучил мышь использования обеими руками приблизительно 10 лет назад.

Это удивительно легко, и снимает напряжение существенно. В настоящее время я использую ноутбук и нажимаю, кнопка сенсорной панели напрягает мой ползунок.

Быть осторожным. Эти проблемы могут продлиться путь дольше, чем можно было бы думать.

<час>

p.s. Вы могли бы добавить тег 'эргономика' или что-то - заголовок виден, чтобы быть [приблизительно 110] разработкой для распознавания речи.

115
задан NotDan 24 November 2009 в 18:20
поделиться

3 ответа

169
ответ дан 24 November 2019 в 02:19
поделиться

Additionally, DataContractSerializer will serialize items marked as [Serializable] and will also serialize unmarked types in .NET 3.5 SP1 and later, to allow support for serializing anonymous types.

So, it depends on how you've decorated your class as to how to keep a member from serializing:

  • If you used [DataContract], then remove the [DataMember] for the property.
  • If you used [Serializable], then add [NonSerialized] in front of the field for the property.
  • If you haven't decorated your class, then you should add [IgnoreDataMember] to the property.
155
ответ дан 24 November 2019 в 02:19
поделиться

What you are saying is in conflict with what it says in the MSDN library at this location:

http://msdn.microsoft.com/en-us/library/system.runtime.serialization.datacontractserializer.aspx

I don't see any mention of the SP1 feature you mention.

0
ответ дан 24 November 2019 в 02:19
поделиться
Другие вопросы по тегам:

Похожие вопросы: