MethodImpl
来自软件开发
简介
指定如何实现方法的详细信息。
示例:The following example applies the MethodImplAttribute to the GetCalendarName method to ensure that it is not inlined at run time by the just-in-time (JIT) compiler.
using System; using System.Globalization; using System.Runtime.CompilerServices; public class Utility { [MethodImplAttribute(MethodImplOptions.NoInlining)] public static string GetCalendarName(Calendar cal) { return cal.ToString().Replace("System.Globalization.", ""). Replace("Calendar", ""); } }