Display Version number of the specified component

Description :

This code shows how we can Display the version number of the specified component.

Following are the namespaces

using System;
using System.Reflection;

Following is the code area to get the version no

public class VersionNumber
public static void Main()
Type Mytype = Type.GetType ("System.Int32");
Assembly assembly = Assembly.GetAssembly (Mytype);
AssemblyName MyassemblyName = assembly.GetName();
Version version = MyassemblyName.Version;
Console.WriteLine ("Version: {0}", version);
Console.WriteLine ("Major: {0}", version.Major);
Console.WriteLine ("Minor: {0}", version.Minor);
Console.WriteLine ("Build: {0}", version.Build);
Console.WriteLine ("Revision: {0}", version.Revision);

Code Explanation

1. Create the instance of the type of the component
2. Create the instance of the assembly
3. Create the instance of the version
4. Get the version no



No responses found. Be the first to comment...

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: