hippiewho
hippiewho
CC#
Created by Fatih on 7/28/2023 in #help
✅ Model not binding to View' issue in ASP.NET
It shouldnt be necessary though and I can't find anything wrong with your code 🤔
12 replies
CC#
Created by Fatih on 7/28/2023 in #help
✅ Model not binding to View' issue in ASP.NET
Maybe add [FromBody] to the parameter list? Like:
Register([FromBody] RegisterModel model)
Register([FromBody] RegisterModel model)
12 replies
CC#
Created by Slem P on 11/16/2022 in #help
❔ C code wont run
Gonna need a little more info
8 replies
CC#
Created by Slem P on 11/16/2022 in #help
❔ C code wont run
Or is it that the insert doesnt work?
8 replies
CC#
Created by Slem P on 11/16/2022 in #help
❔ C code wont run
It doesnt start?
8 replies
CC#
Created by CoreVisional on 11/15/2022 in #help
❔ Compare Enum Values with submitted value
Actually you got me thinking and so i just tested this out. I was wrong, you would need to make the values of the enum into powers of 2. By default enums are start at 0 get assigned a value +1 greater than the previous. Has flag only works correctly if the values are non zero and power of two. The flags attribute can enforce that rule but HasFlag is part of the enum type and can be used (incorrectly) when the enum is not power of 2
75 replies
CC#
Created by CoreVisional on 11/15/2022 in #help
❔ Compare Enum Values with submitted value
I honestly dont remember the reasons for the restrictions
75 replies
CC#
Created by CoreVisional on 11/15/2022 in #help
❔ Compare Enum Values with submitted value
The has flag works rgardless because at its core its a bitwise check (IIRC). The flags attribute markes the enum as a powers of 2 flag (under the hood it uses binary flags - 0001, 0010, 0100, 1000, etc)
75 replies
CC#
Created by CoreVisional on 11/15/2022 in #help
❔ Compare Enum Values with submitted value
The flags attribute should really only be used when the enums values are base 2. ei 0,1,2,4,8,16,etc EDIT: meant powers of 2
75 replies
CC#
Created by CoreVisional on 11/15/2022 in #help
❔ Compare Enum Values with submitted value
Well if you added the Weekends values to Days then all you would need to do is bool isWeeknd = Days.Weekends.HasFlag(day.Day); Assuming day.Day is of enum type Days
75 replies
CC#
Created by CoreVisional on 11/15/2022 in #help
❔ Compare Enum Values with submitted value
yup thats reasonable lol
75 replies
CC#
Created by CoreVisional on 11/15/2022 in #help
❔ Compare Enum Values with submitted value
Tho i guess this would create issues if you try to dynamically enumerate the values into a list or somethin
75 replies
CC#
Created by CoreVisional on 11/15/2022 in #help
❔ Compare Enum Values with submitted value
I ask because maybe it would be cleaner to do something like
enum Days{
Mon,
Tues,
...,
Saturday,
Sunday,
Weekends = Saturday|Sunday
}
enum Days{
Mon,
Tues,
...,
Saturday,
Sunday,
Weekends = Saturday|Sunday
}
75 replies
CC#
Created by CoreVisional on 11/15/2022 in #help
❔ Compare Enum Values with submitted value
Bitwise ops are a little faster i think but really its negligible. Im curious tho, is the weekends enum new or does it exist in your code base already?
75 replies
CC#
Created by CoreVisional on 11/15/2022 in #help
❔ Compare Enum Values with submitted value
nope
75 replies
CC#
Created by CoreVisional on 11/15/2022 in #help
❔ Compare Enum Values with submitted value
do you need it? you cant use it if you want to use HasFlag
75 replies
CC#
Created by CoreVisional on 11/15/2022 in #help
❔ Compare Enum Values with submitted value
are you using the flags attribute?
75 replies
CC#
Created by CoreVisional on 11/15/2022 in #help
❔ Compare Enum Values with submitted value
If im understanding correctly you just want to make the expression shorter? Maybe something like
var weekends = Weekends.Saturday | Weekends.Sunday;
bool isWeekEnd = weekends.HasFlag(day.Day);
var weekends = Weekends.Saturday | Weekends.Sunday;
bool isWeekEnd = weekends.HasFlag(day.Day);
75 replies
CC#
Created by hippiewho on 10/20/2022 in #help
CryptoStream decrypt encrypt
Yea I did...
8 replies
CC#
Created by hippiewho on 10/20/2022 in #help
CryptoStream decrypt encrypt
I read this as well... And it does seem to be a padding issue but none of the padding options work... I changed it up a bit and i was able to get the decrypt method to decrypt most of the string.... The last few bits are missing. I ended up adding a few characters to the rawValue string and it decrypted the entire string correctly (with the padding characters I added). Still so lost
8 replies