Click here to Skip to main content
14,098,213 members
   

C#

 
AnswerRe: Only Numeric Textbox ( Back Space is working ) Pin
Gerry Schmitz6-Mar-19 4:30
mveGerry Schmitz6-Mar-19 4:30 
AnswerRe: Only Numeric Textbox ( Back Space is working ) Pin
qA-Cp24-Mar-19 23:27
memberqA-Cp24-Mar-19 23:27 
QuestionEfficient way of updating items Pin
Danpeking6-Mar-19 0:41
memberDanpeking6-Mar-19 0:41 
AnswerRe: Efficient way of updating items Pin
OriginalGriff6-Mar-19 1:01
protectorOriginalGriff6-Mar-19 1:01 
AnswerRe: Efficient way of updating items Pin
F-ES Sitecore6-Mar-19 2:35
mveF-ES Sitecore6-Mar-19 2:35 
AnswerRe: Efficient way of updating items Pin
Gerry Schmitz6-Mar-19 4:24
mveGerry Schmitz6-Mar-19 4:24 
QuestionVS 2017 c# Getting Current Version number Pin
ormonds5-Mar-19 16:52
memberormonds5-Mar-19 16:52 
AnswerRe: VS 2017 c# Getting Current Version number Pin
OriginalGriff5-Mar-19 20:04
protectorOriginalGriff5-Mar-19 20:04 
These are the methods I use:
/// <summary>
/// Gets the assembly Title
/// </summary>
public string AssemblyTitle
    {
    get
        {
        object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
        if (attributes.Length > 0)
            {
            AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0];
            if (titleAttribute.Title != "")
                {
                return titleAttribute.Title;
                }
            }
        return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase);
        }
    }
/// <summary>
/// Gets the assembly Version
/// </summary>
public string AssemblyVersion
    {
    get
        {
        return Assembly.GetExecutingAssembly().GetName().Version.ToString();
        }
    }
/// <summary>
/// Gets the assembly Description
/// </summary>
public string AssemblyDescription
    {
    get
        {
        object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false);
        if (attributes.Length == 0)
            {
            return "";
            }
        return ((AssemblyDescriptionAttribute)attributes[0]).Description;
        }
    }
/// <summary>
/// Gets the assembly Product
/// </summary>
public string AssemblyProduct
    {
    get
        {
        object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false);
        if (attributes.Length == 0)
            {
            return "";
            }
        return ((AssemblyProductAttribute)attributes[0]).Product;
        }
    }
/// <summary>
/// Gets the assembly copyright notice
/// </summary>
public string AssemblyCopyright
    {
    get
        {
        object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
        if (attributes.Length == 0)
            {
            return "";
            }
        return ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
        }
    }
/// <summary>
/// Gets the assembly Company
/// </summary>
public string AssemblyCompany
    {
    get
        {
        object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false);
        if (attributes.Length == 0)
            {
            return "";
            }
        return ((AssemblyCompanyAttribute)attributes[0]).Company;
        }
    }
Note that is the Executing Assembly it fetches data for - i.e. the assembly that that specific code is compiled into. If that is a DLL used by the app - i.e. a code library - it will fetch the data for the DLL, not the original EXE that called it. For the original EXE assembly data, replace GetExecutingAssembly with GetEntryAssembly
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!

GeneralRe: VS 2017 c# Getting Current Version number Pin
ormonds6-Mar-19 17:54
memberormonds6-Mar-19 17:54 
GeneralRe: VS 2017 c# Getting Current Version number Pin
OriginalGriff6-Mar-19 22:11
protectorOriginalGriff6-Mar-19 22:11 
GeneralRe: VS 2017 c# Getting Current Version number Pin
ormonds7-Mar-19 0:33
memberormonds7-Mar-19 0:33 
QuestionBest Architecture dotnet app Pin
Member 132039775-Mar-19 5:38
memberMember 132039775-Mar-19 5:38 
AnswerRe: Best Architecture dotnet app Pin
Gerry Schmitz5-Mar-19 7:57
mveGerry Schmitz5-Mar-19 7:57 
RantRe: Best Architecture dotnet app Pin
Bohdan Stupak5-Mar-19 22:25
professionalBohdan Stupak5-Mar-19 22:25 
GeneralRe: Best Architecture dotnet app Pin
Member 132039775-Mar-19 23:42
memberMember 132039775-Mar-19 23:42 
GeneralRe: Best Architecture dotnet app Pin
Bohdan Stupak6-Mar-19 1:04
professionalBohdan Stupak6-Mar-19 1:04 
QuestionUsing the Black Box method in C# Pin
Brian_TheLion4-Mar-19 18:57
memberBrian_TheLion4-Mar-19 18:57 
AnswerRe: Using the Black Box method in C# Pin
OriginalGriff4-Mar-19 20:00
protectorOriginalGriff4-Mar-19 20:00 
GeneralRe: Using the Black Box method in C# Pin
Brian_TheLion4-Mar-19 23:20
memberBrian_TheLion4-Mar-19 23:20 
GeneralRe: Using the Black Box method in C# Pin
OriginalGriff5-Mar-19 0:04
protectorOriginalGriff5-Mar-19 0:04 
GeneralRe: Using the Black Box method in C# Pin
Brian_TheLion5-Mar-19 11:47
memberBrian_TheLion5-Mar-19 11:47 
AnswerRe: Using the Black Box method in C# Pin
Gerry Schmitz5-Mar-19 8:10
mveGerry Schmitz5-Mar-19 8:10 
GeneralRe: Using the Black Box method in C# Pin
Brian_TheLion5-Mar-19 11:45
memberBrian_TheLion5-Mar-19 11:45 
GeneralRe: Using the Black Box method in C# Pin
Gerry Schmitz6-Mar-19 4:13
mveGerry Schmitz6-Mar-19 4:13 
GeneralRe: Using the Black Box method in C# Pin
Brian_TheLion6-Mar-19 11:32
memberBrian_TheLion6-Mar-19 11:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Cookies | Terms of Service
Web04 | 2.8.190518.1 | Last Updated 20 May 2019
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid