Click here to Skip to main content
15,891,423 members
Home / Discussions / C#
   

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
qA-Cp24-Mar-19 23:27 
QuestionEfficient way of updating items Pin
Danpeking6-Mar-19 0:41
Danpeking6-Mar-19 0:41 
AnswerRe: Efficient way of updating items Pin
OriginalGriff6-Mar-19 1:01
mveOriginalGriff6-Mar-19 1:01 
AnswerRe: Efficient way of updating items Pin
F-ES Sitecore6-Mar-19 2:35
professionalF-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
ormonds5-Mar-19 16:52 
AnswerRe: VS 2017 c# Getting Current Version number Pin
OriginalGriff5-Mar-19 20:04
mveOriginalGriff5-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
ormonds6-Mar-19 17:54 
GeneralRe: VS 2017 c# Getting Current Version number Pin
OriginalGriff6-Mar-19 22:11
mveOriginalGriff6-Mar-19 22:11 
GeneralRe: VS 2017 c# Getting Current Version number Pin
ormonds7-Mar-19 0:33
ormonds7-Mar-19 0:33 
QuestionBest Architecture dotnet app Pin
Member 132039775-Mar-19 5:38
Member 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
Member 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
Brian_TheLion4-Mar-19 18:57 
AnswerRe: Using the Black Box method in C# Pin
OriginalGriff4-Mar-19 20:00
mveOriginalGriff4-Mar-19 20:00 
GeneralRe: Using the Black Box method in C# Pin
Brian_TheLion4-Mar-19 23:20
Brian_TheLion4-Mar-19 23:20 
GeneralRe: Using the Black Box method in C# Pin
OriginalGriff5-Mar-19 0:04
mveOriginalGriff5-Mar-19 0:04 
GeneralRe: Using the Black Box method in C# Pin
Brian_TheLion5-Mar-19 11:47
Brian_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
Brian_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
Brian_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.