本文整理汇总了C#中Type.RemoveLast方法的典型用法代码示例。如果您正苦于以下问题:C# Type.RemoveLast方法的具体用法?C# Type.RemoveLast怎么用?C# Type.RemoveLast使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Type
的用法示例。
在下文中一共展示了Type.RemoveLast方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MakeNewCustomDelegate
private static Type MakeNewCustomDelegate(Type[] types) {
Type returnType = types[types.Length - 1];
Type[] parameters = types.RemoveLast();
TypeBuilder builder = Snippets.Shared.DefineDelegateType("Delegate" + types.Length);
builder.DefineConstructor(CtorAttributes, CallingConventions.Standard, _DelegateCtorSignature).SetImplementationFlags(ImplAttributes);
builder.DefineMethod("Invoke", InvokeAttributes, returnType, parameters).SetImplementationFlags(ImplAttributes);
return builder.CreateType();
}
示例2: MakeNewCustomDelegate
private static Type MakeNewCustomDelegate(Type[] types)
{
#if FEATURE_CORECLR
Type returnType = types[types.Length - 1];
Type[] parameters = types.RemoveLast();
TypeBuilder builder = AssemblyGen.DefineDelegateType("Delegate" + types.Length);
builder.DefineConstructor(CtorAttributes, CallingConventions.Standard, s_delegateCtorSignature).SetImplementationFlags(ImplAttributes);
builder.DefineMethod("Invoke", InvokeAttributes, returnType, parameters).SetImplementationFlags(ImplAttributes);
return builder.CreateType();
#else
throw new PlatformNotSupportedException();
#endif
}
示例3: MakeNewDelegate
internal static Type MakeNewDelegate(Type[] types)
{
Debug.Assert(types != null && types.Length > 0);
// Can only used predefined delegates if we have no byref types and
// the arity is small enough to fit in Func<...> or Action<...>
bool needCustom;
if (types.Length > MaximumArity)
{
needCustom = true;
}
else
{
needCustom = false;
for (int i = 0; i < types.Length; i++)
{
Type type = types[i];
if (type.IsByRef || type.IsPointer)
{
needCustom = true;
break;
}
}
}
if (needCustom)
{
#if FEATURE_COMPILE
return MakeNewCustomDelegate(types);
#else
return TryMakeVBStyledCallSite(types) ?? MakeNewCustomDelegate(types);
#endif
}
Type result;
if (types[types.Length - 1] == typeof(void))
{
result = GetActionType(types.RemoveLast());
}
else
{
result = GetFuncType(types);
}
Debug.Assert(result != null);
return result;
}
示例4: MakeDelegate
internal static Type MakeDelegate(Type[] types) {
Debug.Assert(types != null && types.Length > 0);
// Can only used predefined delegates if we have no byref types and
// the arity is small enough to fit in Func<...> or Action<...>
if (types.Length > MaximumArity || types.Any(t => t.IsByRef)) {
return MakeCustomDelegate(types);
}
Type result;
if (types[types.Length - 1] == typeof(void)) {
result = GetActionType(types.RemoveLast());
} else {
result = GetFuncType(types);
}
Debug.Assert(result != null);
return result;
}