0

Take a look at these c++ codes :

enum class Flag : int32 {
    f_unread = (1 << 0),
    f_out = (1 << 1),
    f_mentioned = (1 << 4),

    MAX_FIELD = (1 << 15),
};

Q_DECLARE_FLAGS(Flags, Flag);

friend inline Flags operator~(Flag v)
{
   return QFlag(~static_cast<int32>(v));
}

My Questions :

  1. What do exactly Q_DECLARE_FLAGS function do and what is the replacement of it in c#?
  2. What are Flags & QFlag?

Would you please convert those codes to c#!

SilverLight
  • 19,668
  • 65
  • 192
  • 300
  • Related : http://stackoverflow.com/questions/37387986/enum-class-in-c-replacement-in-c-sharp – SilverLight May 23 '16 at 11:12
  • http://doc.qt.io/qt-5/qflags.html – Bo Persson May 23 '16 at 11:18
  • 1
    Please read [this](http://meta.stackoverflow.com/a/296126/1997232). You didn't explain yourself clearly, it seems you have understanding what it's about [bit flags](http://stackoverflow.com/q/8447/1997232), so why do you need `operator~` in `C#`? – Sinatr May 23 '16 at 11:46
  • I read the second link and it was very useful and i completely understood it. but i'm not familiar with `QT` and really dotn't know what are those codes doing. Just explain it for me by an example. – SilverLight May 23 '16 at 12:02

0 Answers0