We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When using bitwise operators on a flags enum, the resulting type is int, but it should be the enum type.
int
Here's a repro:
namespace DynamicLinqExample { public class Example { [Flags] public enum ExampleFlags { None = 0, A = 1, B = 2, C = 4, D = 8, }; [Fact] public void FlagsEnumBitwiseOperatorsWrongResultType() { var query = new[] { 0 }.AsQueryable(); var result1 = query.Select(x => ExampleFlags.A | ExampleFlags.B).First(); Assert.IsType<ExampleFlags>(result1); // <-- succeeds var result2 = query.Select("@0 | @1", ExampleFlags.A, ExampleFlags.B).First(); Assert.IsType<ExampleFlags>(result2); // <-- fails; type is int } } }
This results in:
Assert.IsType() Failure Expected: DynamicLinqExample.Example+ExampleFlags Actual: System.Int32
Thanks!
The text was updated successfully, but these errors were encountered:
@jbhelm This will be fixed in next release.
#720
Sorry, something went wrong.
StefH
No branches or pull requests
When using bitwise operators on a flags enum, the resulting type is
int
, but it should be the enum type.Here's a repro:
This results in:
Thanks!
The text was updated successfully, but these errors were encountered: