Пример #1
0
 internal static OneofAccessor ForRegularOneof(
     OneofDescriptor descriptor,
     PropertyInfo caseProperty,
     MethodInfo clearMethod) =>
 new OneofAccessor(
     descriptor,
     ReflectionUtil.CreateFuncIMessageInt32(caseProperty.GetGetMethod()),
     ReflectionUtil.CreateActionIMessage(clearMethod));
Пример #2
0
        internal OneofAccessor(PropertyInfo caseProperty, MethodInfo clearMethod, OneofDescriptor descriptor)
        {
            if (!caseProperty.CanRead)
            {
                throw new ArgumentException("Cannot read from property");
            }
            this.descriptor = descriptor;
            caseDelegate    = ReflectionUtil.CreateFuncIMessageInt32(caseProperty.GetGetMethod());

            this.descriptor = descriptor;
            clearDelegate   = ReflectionUtil.CreateActionIMessage(clearMethod);
        }