APG.CodeHelper.UI.ApplicationAboutDialog.AssemblyTitle C# (CSharp) 메소드

AssemblyTitle() 공개 정적인 메소드

public static AssemblyTitle ( Assembly assembly ) : string
assembly Assembly
리턴 string
        public static string AssemblyTitle(Assembly assembly)
        {
            // Get all Title attributes on this assembly
                object[] attributes = assembly.GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
                // If there is at least one Title attribute
                if (attributes.Length > 0)
                {
                    // Select the first one
                    AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0];
                    // If it is not an empty string, return it
                    if (titleAttribute.Title != "")
                        return titleAttribute.Title;
                }
                // If there was no Title attribute, or if the Title attribute was the empty string, return the .exe name
                try
                {
                    return System.IO.Path.GetFileNameWithoutExtension(assembly.CodeBase);
                }
                catch (NotSupportedException)
                {
                    return "Нет данных";
                }
        }