My code does not appear to be formatting correctly when I ctrl k,f.

looks like this...

namespace CS_TexasHoldem
{
    class Card
    {
        private

            char suit;
        char value;

        public

            Card()
        {

        }
    }
}

Does that look weird?
What can I do about it, I'm pretty sure it does not do that when using C++.

This is with the whole namespace selected.

Edited 1 Year Ago by Suzie999

this won't do. It's only valid in C++ to have that kind of syntaxes. To configure the access modifiers in C# you have to declare them manually like:

private char suit { get; set; }
private char value { get; set; }

public Card()
{

}

It's valid syntax, but guaranteed to be confusing and very likely to become incorrect as more members are added to the class. The private qualifier only explicitly applies to suit, and the public qualifier will only apply to your constructor. value will have default visibility, which in this case is private.

Yes, I was treating it as though it were C++.

Although I've used C# before, I've never needed to write my own class as they've been generated in a windows forms project.

I suppose it's understandable that the auto formatting would not like the way I had done it.

Thanks for details.

This question has already been answered. Start a new discussion instead.