breakfast
breakfast
CC#
Created by breakfast on 9/18/2023 in #help
❔ [Unity-ish/Newtonsoft] Efficient ways to deserialize a large amount of json data.
No description
35 replies
CC#
Created by breakfast on 8/1/2023 in #help
Is Regex overkill for ~2000 strings and a few conditions?
Goal: My input is a list of usernames returned from an API that only contain alphanumerics and underscores. Conditionally I'd like to only break the string apart only the first time any of these conditions are met: 1. Encounter a literal "_" 2. Encounter an upper case after a lower case 3. Encounter an upper case after an upper case. Is Regex kinda overkill or simply not the "right" tool for this or am I in the right ballpark? I figure I could also use string.Replace or break the strings down and do Char comparisons then compare the results.
4 replies
CC#
Created by breakfast on 3/8/2023 in #help
❔ Practical use for bitwise operators, specifically |= in context.
Not bitwise application. This is a simple boolean or equals Howdy folks. Currently working in a new codebase with a lot of legacy code and 0 of the folks that wrote it still around. To preface I ran into this bit of code and am failing to truly understand what it's doing.
bool myFlag = myString == string.Empty;
myFlag |= GetCategoryCount(currentType) == 1;

// Attempting to simplify this. Singleton where we're returning the index count from a Category type.
bool myFlag = myString == string.Empty;
myFlag |= GetCategoryCount(currentType) == 1;

// Attempting to simplify this. Singleton where we're returning the index count from a Category type.
Now I do understand the basics of bit-level operators and how they function at the operator level (bit column comparisons resulting in a new binary representation ). I've just never ran into them in production, and honestly might still be too "green" with them to understand what they're doing exactly. Happy to give more context, but as it stands I'm uncertain of the dev was trying to achieve here.
8 replies