Returns the assembly where the current type is defined - CSharp System.Reflection

CSharp examples for System.Reflection:Assembly

Description

Returns the assembly where the current type is defined

Demo Code

// Copyright (c) Costin Morariu. All rights reserved.
using System.Reflection;
using System.Collections.Generic;
using System;/*from  ww  w. j av a2s.co  m*/

public class Main{
        /// <summary>
        /// Returns the assembly where the current type is defined
        /// </summary>
        /// <param name="type">Current type</param>
        /// <returns>The assembly in wich the type is defined</returns>
        public static Assembly GetAssembly(this Type type)
        {
            return type.GetTypeInfo().Assembly;
        }
}

Related Tutorials