private void GeneratePropertySetMethod(PropertyInfo propertyInfo, AttributeAttribute attribute, MethodInfo setMethodInfo)
            {
                var propertyType = propertyInfo.PropertyType;
                var emit         = Emit.BuildInstanceMethod(__voidType, new[] { propertyType }, _typeBuilder, setMethodInfo.Name, setMethodInfo.Attributes & ~MethodAttributes.Abstract);

                var attributeType      = __attributeType.MakeGenericType(_type, propertyInfo.PropertyType);
                var setValueMethodInfo = attributeType.GetProperty("Value", propertyType).GetSetMethod();

                var nodeLocal = emit.DeclareLocal(attributeType);
                var label     = emit.DefineLabel();

                emit.LoadArgument(0);
                emit.LoadConstant(attribute.LocalName ?? propertyInfo.Name);
                emit.CallVirtual(__getAttributeNodeMethodInfo);
                emit.IsInstance(attributeType);
                emit.StoreLocal(nodeLocal);
                emit.LoadLocal(nodeLocal);
                emit.LoadNull();
                emit.BranchIfEqual(label);
                //emit.UnsignedBranchIfNotEqual(label);
                emit.LoadLocal(nodeLocal);
                emit.LoadArgument(1);
                emit.CallVirtual(setValueMethodInfo);
                emit.MarkLabel(label);
                emit.Return();

                _typeBuilder.DefineMethodOverride(emit.CreateMethod(), setMethodInfo);
            }
            private void GeneratePropertyGetMethod(PropertyInfo propertyInfo, AttributeAttribute attribute, MethodInfo getMethodInfo)
            {
                var propertyType = propertyInfo.PropertyType;
                var emit         = Emit.BuildInstanceMethod(propertyType, __emptyTypes, _typeBuilder, getMethodInfo.Name, getMethodInfo.Attributes & ~MethodAttributes.Abstract);

                var attributeType      = __attributeType.MakeGenericType(_type, propertyInfo.PropertyType);
                var getValueMethodInfo = attributeType.GetProperty("Value", propertyType).GetGetMethod();

                var nodeLocal   = emit.DeclareLocal(attributeType);
                var resultLocal = emit.DeclareLocal(propertyInfo.PropertyType);
                var label1      = emit.DefineLabel();
                var label2      = emit.DefineLabel();

                emit.LoadArgument(0);
                emit.LoadConstant(attribute.LocalName ?? propertyInfo.Name);
                emit.CallVirtual(__getAttributeNodeMethodInfo);
                emit.IsInstance(attributeType);
                emit.StoreLocal(nodeLocal);
                emit.LoadLocal(nodeLocal);
                emit.LoadNull();
                emit.BranchIfEqual(label1);
                //emit.UnsignedBranchIfNotEqual(label1);
                emit.LoadLocal(nodeLocal);
                emit.CallVirtual(getValueMethodInfo);
                emit.StoreLocal(resultLocal);
                emit.Branch(label2);
                emit.MarkLabel(label1);
                emit.WriteLine("Get: {0}", nodeLocal);

                if (propertyType.IsValueType)
                {
                    emit.LoadLocalAddress(resultLocal);
                    emit.InitializeObject(propertyType);
                }
                else
                {
                    emit.LoadNull();
                    emit.StoreLocal(resultLocal);
                }

                emit.Branch(label2);
                emit.MarkLabel(label2);
                emit.LoadLocal(resultLocal);
                emit.Return();

                _typeBuilder.DefineMethodOverride(emit.CreateMethod(), getMethodInfo);
            }