0

Is there a way to serialize a object ignoring the [PropertyName("FooBar")]?

Details: My object has enormous property names that are read all over the frontend... the problem is that it causes me to waste about 35% of space... when you take caching in consideration, this is a huge problem

Leonardo
  • 10,737
  • 10
  • 62
  • 155
  • Can you remove the `[PropertyName("FooBar")]` ? – Mafii Jul 05 '17 at 15:28
  • @Mafii my intent is to place it, and have the serialization to the front end ignore it... serialize to cache will use it – Leonardo Jul 05 '17 at 15:31
  • 3
    You can probably accomplish this by creating a contract resolver, which inherits from `DefaultContractResolver`, and using that resolver in the front end where you want to ignore the attributes. –  Jul 05 '17 at 15:33
  • @Amy would you pls put it as answer... it's good enough for me – Leonardo Jul 13 '17 at 12:49
  • @Leonardo okay, I submitted it as an answer. Should I elaborate at all (i dont mind)? Or is it okay as-is? –  Jul 13 '17 at 21:50

1 Answers1

0

You can accomplish this by creating a contract resolver, which inherits from DefaultContractResolver, and using that resolver in the front end where you want to ignore the attributes.