コード例 #1
0
            private void StoreOverriddenMethod(OverriddenMembers overrides, MethodInfo mi, string newName)
            {
                MemberInfo[] members = _baseType.GetMember(newName, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static | BindingFlags.FlattenHierarchy);
                Debug.Assert(members.Length > 0, String.Format("{0} from {1}", newName, _baseType.Name));
                Type declType = members[0].DeclaringType;

                overrides.AddMethod(mi, newName);
            }
コード例 #2
0
            private void StoreOverriddenField(OverriddenMembers overrides, MethodInfo mi, string newName)
            {
                string fieldName = newName.Substring(FieldGetterPrefix.Length); // get_ or set_

                foreach (FieldInfo pi in _baseType.GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static | BindingFlags.FlattenHierarchy))
                {
                    if (pi.Name == fieldName)
                    {
                        if (newName.StartsWith(FieldGetterPrefix))
                        {
                            overrides.AddMethod(mi, fieldName);
                        }
                        else if (newName.StartsWith(FieldSetterPrefix))
                        {
                            overrides.AddMethod(mi, fieldName + "=");
                        }
                    }
                }
            }
コード例 #3
0
            private void StoreOverriddenProperty(OverriddenMembers overrides, MethodInfo mi, string newName)
            {
                string propName = newName.Substring(4); // get_ or set_

                foreach (PropertyInfo pi in _baseType.GetProperties(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static | BindingFlags.FlattenHierarchy))
                {
                    if (pi.Name == propName)
                    {
                        if (newName.StartsWith("get_"))
                        {
                            overrides.AddMethod(mi, propName);
                        }
                        else if (newName.StartsWith("set_"))
                        {
                            overrides.AddMethod(mi, propName + "=");
                        }
                    }
                }
            }
コード例 #4
0
            private void StoreOverriddenMethod(OverriddenMembers overrides, MethodInfo mi, string newName) {
                MemberInfo[] members = _baseType.GetMember(newName, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static | BindingFlags.FlattenHierarchy);
                Debug.Assert(members.Length > 0, String.Format("{0} from {1}", newName, _baseType.Name));
                Type declType = members[0].DeclaringType;

                overrides.AddMethod(mi, newName);
            }
コード例 #5
0
 private void StoreOverriddenField(OverriddenMembers overrides, MethodInfo mi, string newName) {
     string fieldName = newName.Substring(FieldGetterPrefix.Length); // get_ or set_
     foreach (FieldInfo pi in _baseType.GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static | BindingFlags.FlattenHierarchy)) {
         if (pi.Name == fieldName) {
             if (newName.StartsWith(FieldGetterPrefix)) {
                 overrides.AddMethod(mi, fieldName);
             } else if (newName.StartsWith(FieldSetterPrefix)) {
                 overrides.AddMethod(mi, fieldName + "=");
             }
         }
     }
 }
コード例 #6
0
 private void StoreOverriddenProperty(OverriddenMembers overrides, MethodInfo mi, string newName) {
     string propName = newName.Substring(4); // get_ or set_
     foreach (PropertyInfo pi in _baseType.GetProperties(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static | BindingFlags.FlattenHierarchy)) {
         if (pi.Name == propName) {
             if (newName.StartsWith("get_")) {
                 overrides.AddMethod(mi, propName);
             } else if (newName.StartsWith("set_")) {
                 overrides.AddMethod(mi, propName + "=");
             }
         }
     }
 }