Get Assembly Culture - CSharp System.Reflection

CSharp examples for System.Reflection:Assembly

Description

Get Assembly Culture

Demo Code

// The MIT License
using System.Runtime.InteropServices;
using System.Reflection;
using System.Linq;
using System;//from   w  w  w .j a  v  a  2s  .  co  m

public class Main{
        public static string GetAssemblyCulture(this Assembly assembly)
        {
            var query = from cultures in assembly.GetCustomAttributes<AssemblyCultureAttribute>()
                        select cultures;

            if(1 == query.Count())
            {
                return query.First().Culture;
            }

            return "";
        }
}

Related Tutorials