internal static bool IsMethodAllowedRemotely(MethodBase method)
{
// MarhsalByRefObject.InvokeMember is allowed to be invoked remotely. It is a wrapper for a com method as represented in managed
// code. The managed code was generated by tlbimpl. A test does not have to be made to make sure that the COM object method is public because
// the tlbimpl will only generate methods which can be invoked remotely.
if (s_FieldGetterMB == null ||
s_FieldSetterMB == null ||
s_IsInstanceOfTypeMB == null ||
s_InvokeMemberMB == null ||
s_CanCastToXmlTypeMB == null)
{
System.Security.CodeAccessPermission.AssertAllPossible();
if (s_FieldGetterMB == null)
s_FieldGetterMB = typeof(Object).GetMethod(FieldGetterName,RemotingServices.LookupAll);
if (s_FieldSetterMB == null)
s_FieldSetterMB = typeof(Object).GetMethod(FieldSetterName, RemotingServices.LookupAll);
if (s_IsInstanceOfTypeMB == null)
{
s_IsInstanceOfTypeMB =
typeof(MarshalByRefObject).GetMethod(
IsInstanceOfTypeName, RemotingServices.LookupAll);
}
if (s_CanCastToXmlTypeMB == null)
{
s_CanCastToXmlTypeMB =
typeof(MarshalByRefObject).GetMethod(
CanCastToXmlTypeName, RemotingServices.LookupAll);
}
if (s_InvokeMemberMB == null)
{
s_InvokeMemberMB =
typeof(MarshalByRefObject).GetMethod(
InvokeMemberName, RemotingServices.LookupAll);
}
}
return
method == s_FieldGetterMB ||
method == s_FieldSetterMB ||
method == s_IsInstanceOfTypeMB ||
method == s_InvokeMemberMB ||
method == s_CanCastToXmlTypeMB;
}