internal Object InternalGetValue(Object obj, bool doVisibilityCheck, bool doCheckConsistency)
{
RuntimeType declaringType = DeclaringType as RuntimeType;
if ((m_invocationFlags & INVOCATION_FLAGS_INITIALIZED) == 0)
GetOneTimeFlags();
if ((m_invocationFlags & INVOCATION_FLAGS_NO_INVOKE) != 0)
{
if (declaringType != null && DeclaringType.ContainsGenericParameters)
throw new InvalidOperationException(Environment.GetResourceString ("Arg_UnboundGenField"));
if ((declaringType == null && Module.Assembly.ReflectionOnly) || declaringType is ReflectionOnlyType)
throw new InvalidOperationException(Environment.GetResourceString("Arg_ReflectionOnlyField"));
throw new FieldAccessException();
}
if (doCheckConsistency)
CheckConsistency(obj);
RuntimeTypeHandle fieldType = FieldType.TypeHandle;
if (doVisibilityCheck &&(m_invocationFlags & INVOCATION_FLAGS_NEED_SECURITY) != 0)
PerformVisibilityCheckOnField(m_fieldHandle.Value, obj, m_declaringType.TypeHandle.Value, m_fieldAttributes, m_invocationFlags & ~INVOCATION_FLAGS_SPECIAL_FIELD);
bool domainInitialized = false;
if (declaringType == null)
{
return m_fieldHandle.GetValue(obj, fieldType, RuntimeTypeHandle.EmptyHandle, ref domainInitialized);
}
else
{
domainInitialized = declaringType.DomainInitialized;
object retVal = m_fieldHandle.GetValue(obj, fieldType, DeclaringType.TypeHandle, ref domainInitialized);
declaringType.DomainInitialized = domainInitialized;
return retVal;
}
}