Provides functionality for getting information about the app.
$ dotnet add package Gapotchenko.FX.AppModel.InformationThe module provides functionality for getting information about the app.
To get information about the current app, use AppInformation.Current property:
using Gapotchenko.FX.AppModel.Information;
using System;
var info = AppInformation.Current;
Console.WriteLine("Product: {0}", info.ProductName);
Console.WriteLine("Version: {0}", info.ProductVersion);
Console.WriteLine("Company: {0}", info.CompanyName);
Console.WriteLine("Copyright: {0}", info.Copyright);
This can be useful for purposes like showing an about box in GUI or a copyright banner in console.
Sometimes a program consists of several parts, each of which has its own associated product information.
To get information about a specific part of the program other than the main app, use AppInformation.For(Type) method:
using Gapotchenko.FX.AppModel.Information;
using System;
var info = AppInformation.For(typeof(object));
Console.WriteLine("Product: {0}", info.ProductName);
Console.WriteLine("Version: {0}", info.ProductVersion);
Console.WriteLine("Company: {0}", info.CompanyName);
Console.WriteLine("Copyright: {0}", info.Copyright);
Note that the example above gets information for System.Object type which belongs to .NET BCL (Base Class Library).
The retrieved information about that part looks like so:
Product: Microsoft® .NET
Version: 8.0.824.36612
Company: Microsoft Corporation
Copyright: © Microsoft Corporation. All rights reserved.
You can use this functionality to retrieve information about any other part of the program. It can be a plugin, a library, and so on.
There also exists AppInformation.For(Assembly) overload of the For method.
That method overload retrieves information about a specific assembly.
It is useful for situations when you have no specific System.Type at hand to retrieve the information for, but only a System.Assembly.
Note that it is preferable to use AppInformation.For(Type) method because it is slightly more precise than AppInformation.For(Assembly).
Gapotchenko.FX.AppModel.AppInformationLet's continue with a look at some other modules provided by Gapotchenko.FX:
Or look at the full list of modules.