Implementation of the structure of general purpose facilities (property bag)

We need to implement some structure of general-purpose objects, like an object in dynamic languages, which will give us the opportunity to create an entire object chart "on the fly." This class should be serializable and somehow user-friendly.

So far, we have done several experiments with a class derived from Dictionary<string, object>using the dot notation path to store properties and collections in an object tree. We also find an article that implements something similar, but it does not seem to fully correspond to our picture.

Do you know about some good implementations / libraries that deal with a similar problem, or do you have any (non-trivial) ideas that can help us in our own implementation?

Also, I probably should say that we are using .NET 3.5, so we cannot use new features in .NET 4.0, such as dynamic type, etc. (as far as I know, it is also impossible to use any subset of it in the .NET 3.5 solution).

+3
source share
3 answers

-, ICustomTypeDescriptor/ITypedList, , . ( BinaryFormatter, ).

, #, . ( ), DataTable/DataRow ? , , / -.

+2

, ( ) XDocument.

, .Net 4.

, :

XElement address = d.Element("Address");
int number = (int)address.Attribute("Number");
+3

Have a look at this CodeProject article which explains how to create a property bag to be used with the property network here , as well as here . I used them because the focus was on your question regarding the property bag.

Hope this helps, Regards, Tom.

0
source

Source: https://habr.com/ru/post/1730247/


All Articles