Skip to content
New issue

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

Popup attribute does not work for int-like variables, such as bytes #90

Open
Phasedragon opened this issue Nov 14, 2021 · 2 comments
Open
Labels
enhancement New feature or request

Comments

@Phasedragon
Copy link

that is all

@orels1
Copy link
Owner

orels1 commented Nov 25, 2021

I need to look up a way to determine if the variable is int-like i guess

@orels1 orels1 added the enhancement New feature or request label Nov 25, 2021
@orels1
Copy link
Owner

orels1 commented Nov 27, 2021

So apparently this is the correct way of doing it

    private static HashSet<Type> NumericTypes = new HashSet<Type>
    {
        typeof(int),
        typeof(uint),
        typeof(double),
        typeof(decimal),
        ...
    };

    internal static bool IsNumericType(Type type)
    {
        return NumericTypes.Contains(type) ||
               NumericTypes.Contains(Nullable.GetUnderlyingType(type));
    }

sigh

Just literally have a hash set of compatible types :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants