CSharp examples for System.Reflection:Assembly
To Product String
// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information. using System.Text; using System.Reflection; using System.Linq; using System.Collections.Generic; using System;//from w ww . j ava 2 s . c o m public class Main{ public static string ToProductString(this Assembly assembly) { StringBuilder sb = new StringBuilder(); string assemblyProduct = FromAttribute<AssemblyProductAttribute>(assembly).Product; string assemblyCopyright = FromAttribute<AssemblyCopyrightAttribute>(assembly).Copyright; if (string.IsNullOrWhiteSpace(assemblyCopyright)) { assemblyCopyright = FromAttribute<AssemblyCompanyAttribute>(assembly).Company; } string assemblyDescription = FromAttribute<AssemblyDescriptionAttribute>(assembly).Description ?? assembly.GetName().Name; sb.AppendLine(assemblyDescription); sb.AppendFormat("{0} v{1}", assemblyProduct, assembly.GetName().Version.ToString(2)); sb.AppendLine(); sb.AppendLine(assemblyCopyright); sb.AppendLine(); return sb.ToString(); } }