0

here's is my enum declaration

enum suit
        {
            greater_than = ">",
            Less_than = "<",
            greater_than_or_equal_to = ">=",
            less_than_or_equal_to = "<=",
        }

and i'm trying to do it like this but no luck.

int zero = 0;

 if(zero suit.greater_than_or_equal_to 1)
  {

  }

is there an other way it do it in a word not in like this ">="?

redzsol
  • 143
  • 15

2 Answers2

1

Logical operator can't be done in word's anymore.

Even if you are thinking it's just the same but in reality it's absolutely different.

there's a lot of reason why the only thing i knew is its just work in symbol sign and cannot be done in word.

Here's some Logical Operator for more details.

Vijunav Vastivch
  • 4,153
  • 1
  • 16
  • 30
1

You could use the power of extension methods:

namespace ConsoleApp1
{
    public static class Int32Extensions
    {
        public static bool IsGreaterThanOrEqualTo(this int x, int y)
        {
            return x >= y;
        }
    }

    internal static class Program
    {
        internal static void Main()
        {
            if (17.IsGreaterThanOrEqualTo(42))
            {
                // ...
            }
        }
    }
}
nvoigt
  • 75,013
  • 26
  • 93
  • 142
  • this work if i'll do it like this int zero = 0; if(IsGreaterThanOrEqualTo(int.Parse(zero.ToString()),15)) { } – redzsol Apr 20 '17 at 09:35
  • @redzsol It **is** a function. And it should work like `zero..IsGreaterThanOrEqualTo(15)`. If it doesn't, you need to paste the error message. Most likely, your Visual Studio and .NET version are older than 5 years. – nvoigt Apr 20 '17 at 09:53