Я создаю небольшое приложение, которому необходимо сохранить объект в файл, чтобы сохранить пользовательские данные. У меня есть два вопроса о сериализации в этот файл:
Создаваемый мной объект имеет некоторые общедоступные свойства и событие. Я добавил к своему объекту атрибут [Serializable]
, а затем понял, что не могу сериализовать объект с событием в нем.
I then discovered that I can just add an attribute above my event [field:NonSerialized]
and it will work. Is this the best way to do this, or should I try to build my Serializable objects without any events inside ?
The object I'm serializing saves some user settings about the app. These settings aren't sensitive enough to go about encrypting them in the file, but i still don't want them to be tampered with manually without opening my application. When i serialize my object to a file using a plain BinaryFormatter
object, via the Serialize()
method, I see readable names of .net object types in the file i'm saving this to. Is there a way for someone to reverse engineer this and see what's being saved without using my program ? Is there a way for someone to build a small application and find out how to DeSerialize the information in this file ? If so, how would i go about hiding the information in this file ?
Are there any other tips/suggestions/best practices i should stick to when going about serializing an object to a file in this kind of scenario ?
Thanks in advance!