System.Reflection.MetadataToken.IsNullToken C# (CSharp) Method

IsNullToken() public static method

public static IsNullToken ( int token ) : bool
token int
return bool
        public static bool IsNullToken(int token) 
        { 
            return (token & 0x00FFFFFF) == 0; 
        }
        #endregion

Usage Example

Esempio n. 1
0
        internal static RuntimeMethodInfo AssignAssociates(int tkMethod, RuntimeTypeHandle declaredTypeHandle, RuntimeTypeHandle reflectedTypeHandle)
        {
            if (MetadataToken.IsNullToken(tkMethod))
            {
                return(null);
            }
            bool flag = !declaredTypeHandle.Equals(reflectedTypeHandle);
            RuntimeMethodHandle methodHandle = declaredTypeHandle.GetModuleHandle().ResolveMethodHandle(tkMethod, declaredTypeHandle.GetInstantiation(), new RuntimeTypeHandle[0]);
            MethodAttributes    attributes   = methodHandle.GetAttributes();
            bool flag2 = (attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.Private;
            bool flag3 = (attributes & MethodAttributes.Virtual) != MethodAttributes.PrivateScope;

            if (flag)
            {
                if (flag2)
                {
                    return(null);
                }
                if (flag3 && ((declaredTypeHandle.GetAttributes() & TypeAttributes.ClassSemanticsMask) == TypeAttributes.AnsiClass))
                {
                    int slot = methodHandle.GetSlot();
                    methodHandle = reflectedTypeHandle.GetMethodAt(slot);
                }
            }
            MethodAttributes  attributes2 = attributes & MethodAttributes.MemberAccessMask;
            RuntimeMethodInfo methodBase  = RuntimeType.GetMethodBase(reflectedTypeHandle, methodHandle) as RuntimeMethodInfo;

            if (methodBase == null)
            {
                methodBase = reflectedTypeHandle.GetRuntimeType().Module.ResolveMethod(tkMethod, null, null) as RuntimeMethodInfo;
            }
            return(methodBase);
        }
All Usage Examples Of System.Reflection.MetadataToken::IsNullToken