enum flags
Posted:
Thu Nov 15, 2012 12:25 am
by kobi7
Hi!
I'm not sure what I'm doing wrong.
I can't find the someEnum.hasFlag(flag) method, that is available in .net 4.
is there a ref I need to add?
is System.Core and cobra.core the same?
thanks for the help
kobi
Re: enum flags
Posted:
Thu Nov 15, 2012 7:25 am
by Charles
Cobra does not currently pick up on .hasFlag. You can use the bitwise and-operator (&) to test flags, same as in most languages and documented here:
http://cobra-language.com/trac/cobra/wiki/Enumif someThing & Thing.Foo, print 'test passed'
Re: enum flags
Posted:
Thu Nov 15, 2012 10:21 am
by kobi7
Thanks Charles.
I thought cobra has full interoperability with the .net library.. that was the misunderstanding.
some usings are auto-loaded in C# (System, I think)
so my thinking was that Enum is hiding there, while in cobra I should be explicit with "use" in order to have it.
can you clarify on that regard? thanks!
Re: enum flags
Posted:
Thu Nov 15, 2012 10:27 am
by kobi7
oh, I now read what you pointed to.
so you built flag checking into the language - very nice!
hurray to less cryptic syntax