Microsoft.Extensions.PlatformAbstractions.ApplicationEnvironment.GetEntryAssembly C# (CSharp) Method

GetEntryAssembly() private static method

private static GetEntryAssembly ( ) : Assembly
return System.Reflection.Assembly
        private static Assembly GetEntryAssembly()
        {
#if NET451
            return Assembly.GetEntryAssembly();
#else
            // TODO: Remove private reflection when we get this: https://github.com/dotnet/corefx/issues/4146
            var getEntryAssemblyMethod =
                typeof(Assembly).GetMethod("GetEntryAssembly", BindingFlags.Static | BindingFlags.NonPublic) ??
                typeof(Assembly).GetMethod("GetEntryAssembly", BindingFlags.Static | BindingFlags.Public);
            return getEntryAssemblyMethod.Invoke(obj: null, parameters: Array.Empty<object>()) as Assembly;
#endif
        }
    }