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 7541639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:56:46+00:00 2026-05-30T07:56:46+00:00

public class SecretNumber { //Construktor public SecretNumber() { Initialize(); _previousGuesses = new List<int>(); }

  • 0
public class SecretNumber
{
    //Construktor
    public SecretNumber()
    {
        Initialize();
        _previousGuesses = new List<int>();
    }

    //Constant
    public const int MaxNumberOfGuesses = 7;

    //Field
    private int _number;
    private List<int> _previousGuesses;

    //Property
    public bool CanMakeGuess
    {
        get;
    }

    public int Count
    {
        get;
    }

    public int? Number
    {
        public get;
    }

    //Lite oklart hur man ska göra när fälten är autoimplementerade
    public Outcome Outcome1
    {
        get
        {
            return Outcome1;
        }
        private set
        {
            Outcome1 = value;
        }
    }

    public ReadOnlyCollection<int> PreviousGuesses
    {
        get;
        set;
    }

    //Methods
    public void Initialize()
    {
        Random random = new Random();

        _number = random.Next(1, 100);

        _previousGuesses.Clear();

        Outcome1 = Outcome.Indefinite;
    }

    private Outcome MakeGuess(int guess)
    {
        if (Number > 1 && Number < 100)
        {
            if (PreviousGuesses.Contains(guess))
            {
                return Outcome.PreviousGuess;
            }
            else if (PreviousGuesses.Count >= MaxNumberOfGuesses)
            {
                return Outcome.NoMoreGuesses;
            }
            if (Number == guess)
            {
                return Outcome.Correct;
            }
            else if (Number < guess)
            {
                return Outcome.High;
            }
     //       else if (Number > guess)
       //     {
                return Outcome.Low;
         //   }
        }
        else
        {
            throw new ArgumentOutOfRangeException("Måste vara inom intervallet 1-100");
        }
    }

    //Enumerator
    enum Outcome
    {
        Indefinite,
        Low,
        High,
        Correct,
        NoMoreGuesses,
        PreviousGuess
    }
}

I get the errormessage that my enum Secret number has lesses accessability than the property Outcome1, but I have no idea why.

The property is called Outcome1 because otherwise the names were mixed up in Visual Studio.

  • 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-05-30T07:56:47+00:00Added an answer on May 30, 2026 at 7:56 am

    Your enum has private visibility as you haven’t given it an explicit visibility, and it’s nested within your SecretNumber class.

    You can’t use a type as a parameter or return type of a member that’s exposed publicly1 when that type isn’t also public – otherwise the caller wouldn’t know what to do with it.

    You can just make it public:

    public enum Outcome
    

    1 That’s not quite the same as “of a public member”. For example, a public (non-overriding) method in an internal type can refer to other internal members as parameters – because the method could still only be called by another type which knew about the “containing” internal type anyway.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

public class Bird { private static int id = 0; private String kind; public
public class MySingletonClass { private static MySingletonClass mySingletonClass; private const decimal someDiscount = 3.00M;
public class PeopleCollection : IEnumerable { private Dictionary<string, Person> listPeople = new Dictionary<string, Person>();
public class AllViewModel { private List<Settings> SettingsList; public ViewAgendaAllViewModel() { client.SupplierListWithSettings(GetSupplierListWithSettings_Completed) } public void
public class MyBindingList : BindingList<int> { public MyBindingList() { } private BindingList<int> temp; public
Public Class FooBar { private int _foo; public int Foo { get { return
public class Bird { private static int id = 0; private String kind; public
public class WordDisplay extends Activity { private int level; private int group; private int
public class Sprite { private static final int BMP_COLUMNS = 3; private static final
public class MyClass { public int Age; public int ID; } public void MyMethod()

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.