Binto86
✅ Can't have interface with abstract static method as parameter in blazor component
I have interface and class like this:
now i want to have
IFoo
as parameter in blazor component like this:
but when i try to pass instance of Foo into the component i get this error: CS8920 The interface 'IFoo' cannot be used as type argument. Static member 'IFoo.Create()' does not have a most specific implementation in the interface.
Any way to fix this?7 replies
✅ Validate input in list in blazor forms
I have blazor EditForm with some inputs, the user can enter multiple people into the form, i handle that by having a button that adds some new fields in which the user can fill out new person. The
bind-value
for those inputs is the certain index list of people i have inside the main class for model (for example modelClass.People[5]
). Now i want to add input validation for example for email, but it doesn't get validated for the inputs that write inside the list. Anyone any idea how to make it work?
this is the relevant part of my code:
3 replies
❔ Bitmap created from graphics appears to be all black
I have some kind of drawing board in winforms. User draws into panel with graphics and than i want to save the image into file. relevant parts of code are (canvas is the name of the panel the user is drawing on):
but the saved image is all black, any ideas why?
2 replies
✅ ✅ Use function that has default implementation in interface from instance of class
I have interface similar to this:
now i have class like this:
and i want to use it like this:
is this possible? maybe some keyword on the interface or something (i know i can cast it, but i don't want to do that)
9 replies
✅ Get instance name inside of class
So i have class like this:
and i want to create
ToString
that will return -[nameOfTheCliFlag] [valueOfTheFlag]
like this
however i can't find o way to get the name of the current instance inside of the class, i thought about nameof(this)
, but that doesn't work
is there any way how to get this working without passing the name of the flag from outside?7 replies
How to deal with stack overflow error [Answered]
So when doing some programming competitions, i often get stack overflow, when doing recursion and the only way (i know about) to not get stack overflow is to not do deep recursion, but i was wondering, if there is any other way, as i kinda need recursion this time.
36 replies
Could not load file or assembly 'System.Collections.Imutable' when using source generators
I am trying source generators, and now i am getting warning
i am pretty sure that this error has something to do with
context.AdditionalFiles
as it didn't occur when i didn't use them, this is my code:
6 replies
Post build event error [Answered]
this is not really c# question, but i am trying to setup postbuild event with my project rn it only echos the project folder. it works fine until i add
if $(ConfigurationName) == Debug
my working thing:
echo $(ProjectDir)bin\Release
non working:
error:
Error MSB3073 The command "if Debug == Debug
5 replies
How to add command to right click context menu for solution explorer in VS 2022 extension
I am trying to create .vsix extension , i want to create command which shows up when i right click .razor file, but i wasn't able to find the correct id for parent to do this, can someone help me please?
48 replies