Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8930289
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:51:34+00:00 2026-06-15T08:51:34+00:00

I am trying to implement Enum into my code for the first time. I

  • 0

I am trying to implement Enum into my code for the first time. I have a simple custom class that looks like this:

public class Application
{
    //Properties
    public string AppID { get; set; }
    public string AppName { get; set; }
    public string AppVer { get; set; }
    public enum AppInstallType { msi, exe }
    public string AppInstallArgs { get; set; }
    public string AppInstallerLocation { get; set; }
}

I have a method within that class called Install() that looks like this:

    public void Install()
    {
        if (AppInstallType.exe)
        {
            ProcessStartInfo procInfo = new ProcessStartInfo("cmd.exe");
            procInfo.Arguments = "/c msiexec.exe /i " + AppInstallerLocation + " " + AppInstallArgs; ;
            procInfo.WindowStyle = ProcessWindowStyle.Normal;

            Process proc = Process.Start(procInfo);
            proc.WaitForExit();
        }
        else
        {
            ProcessStartInfo procInfo = new ProcessStartInfo("cmd.exe");
            procInfo.Arguments = "/c " + AppInstallerLocation + " " + AppInstallArgs;
            procInfo.WindowStyle = ProcessWindowStyle.Normal;

            Process proc = Process.Start(procInfo);
            proc.WaitForExit();
        }
    }

When the AppInstallType was a string, the If statement at the beginning of my Install method worked fine (AppInstallType = “msi”). When I changed AppInstallType to an Enum, I can’t seem to work out the syntax for the if statement.

I would like to avoid having to pass in any parameters to the Install() method, if at all possible. It would be nice to be able to install an app just by calling the Install() method on the Application object, like so:

Application app1 = new Application;
app1.AppInstallType = msi;
app1.Install();

How should I be going about this? Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T08:51:35+00:00Added an answer on June 15, 2026 at 8:51 am

    You have not declared an instance of the Enum, you have simply declared it.

    You need

        public enum AppInstallType { msi, exe }
    
    public class Application
    {
        //Properties
        public string AppID { get; set; }
        public string AppName { get; set; }
        public string AppVer { get; set; }
        public string AppInstallArgs { get; set; }
        public AppInstallType InstallType;
        public string AppInstallerLocation { get; set; }
    }
    
    if(InstallType == AppInstallType.msi)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have one class that declares an enumeration type as: public enum HOME_LOAN_TERMS {FIFTEEN_YEAR,
I'm trying to implement Writable class, but i have no idea on how to
I'm trying to save some time / make my code readable. I have a
I am trying to implement parameterized class in Java with enum as a type
I am trying pass an enum into a method, iterate over that enums values,
I'm trying to implement an abstract method in an enum as in code below,
I am trying implement a most recent widget into my tumblr post. So far,
Trying to implement a search similar to here .This searches properties based on city,locality,property
I trying to implement some relatively simple 2D sprite batching in OpenGL ES 2.0
I am trying to implement a Web User Control into one of my APSX

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.