CSharp examples for System.Reflection:Assembly
get Application Assembly
using System.Web.Compilation; using System.Web; using System.Threading; using System.Reflection; using System.Linq; using System.IO;/*from ww w .j a v a 2 s . c om*/ using System.Diagnostics; using System; public class Main{ static Assembly getApplicationAssembly() { // Are we in a web application? if (HttpContext.Current != null) { // Get the global application type var globalAsax = BuildManager.GetGlobalAsaxType(); if (globalAsax != null && globalAsax.BaseType != null) return globalAsax.BaseType.Assembly; } // Provide entry assembly and fallback to executing assembly return Assembly.GetEntryAssembly() ?? Assembly.GetExecutingAssembly(); } }