DataContractSerializer: почему бы не удалить участников?

Поскольку контекст всей проблемы не является особенно достаточным, я могу только строить догадки.

Пожалуйста, прости меня, если мой ответ не точен.

Поскольку код выполняется только после загрузки файла Xib, исполняемый вами код выполняется.

Таким образом, независимо от того, как вы изменяете изображение в Xib, но код остается тем же, результат всегда будет получен после выполнения кода. Логотип оригинала. Потому что код выполняется после загрузки файла Xib.

5
задан Joe White 13 May 2009 в 11:42
поделиться

2 ответа

Simply because outside service consumers may provide/use that data (they were created before you removed some members). In case you've changed service method signature, DataContractSerializer won't be able to recognize DataContract anymore, because of unknown data members.

So if your service consumers are all known, you can easily manipulate data members at your own will as long as you:

  • don't break consumers or
  • properly inform them of the change
2
ответ дан 15 December 2019 в 01:10
поделиться

One issue is that even if it doesn't break during serialization/deserialization, you could be throwing away data - meaning that you can't successfully round-trip data back to the caller. i.e. given the simple method:

public SomeType Echo(SomeType obj) {
    return obj;
}

If the caller is passing you the old object with the extra property, they might want that value back. You can enable this (separately) with the extension data API, but frankly people rarely bother with this.

2
ответ дан 15 December 2019 в 01:10
поделиться
Другие вопросы по тегам:

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