Get Assembly Location - CSharp System.Reflection

CSharp examples for System.Reflection:Assembly

Description

Get Assembly Location

Demo Code


using System.Reflection;
using System.Linq;
using System.Collections.Generic;
using System;//from   w w w  . j av a2s  . co m

public class Main{
        public static string GetAssemblyLocation(this Type type)
      {
         var asm = type.GetTypeInfo().Assembly;
         var locationProperty = asm.GetType().GetRuntimeProperties().Single(p => p.Name == "Location");
         return (string)locationProperty.GetValue(asm);
      }
}

Related Tutorials