Beispiel #1
0
            internal void LoadDataFromObject()
            {
                Type type = ClrObject.GetType();

                if (_PropertyInfos.Any())
                {
                    foreach (var prop in _PropertyInfos)
                    {
                        if (!prop.CanRead)
                        {
                            continue;
                        }

                        object value = prop.GetValue(ClrObject);
                        this[prop.Name] = value;
                    }
                }
                else if (type.IsPrimitive)
                {
                    this[_PrimitiveValuePropertyKey] = ClrObject;
                }
                else
                {
                    //Missing cases where there's no read-only properties.
                    Debug.Assert(false, "No properties and is not a primitive");
                }
            }