Questions tagged [delegates]
Delegates can refer to several concepts. An object can rely on another (a delegate) to perform a function. Delegation can also refer to programming language feature making use of the method lookup rules for dispatching self-calls. In C#, a delegate defines which method to call when an event is triggered.
delegates
11,362
questions
1
vote
1
answer
50
views
Creating generics with delegate protocol type
I am trying to refactor this code:
@objc protocol BaseDelegate {
func xxx()
}
protocol DerivedDelegate: BaseDelegate {
func yyy()
}
protocol NextDerivedDelegate: BaseDelegate {
func zzz()...
0
votes
1
answer
37
views
How to delegate variable evaluation to the child CMD process in Windows command-line? [duplicate]
I am trying to delegate variable evaluation to the child CMD process in Windows command-line. Consider the following:
set foo=bar
cmd /c "set foo=rod & echo %foo%"
It prints bar and not ...
1
vote
2
answers
97
views
Compiled lambda expression leading to new delegate allocations, whereas non-expression version does not
This compiled expression tree...
var param = Expression.Parameter(typeof(int));
var innerParam = Expression.Parameter(typeof(Action<int>));
var inner = Expression.Lambda(innerParam.Type, ...
0
votes
0
answers
10
views
How to prevent adjacent delegates in a QML Flow from shifting when one expands?
I am working with a QML Flow layout in which I dynamically adjust the height of a delegate (Rectangle with id: zakaz) when a button is pressed. This expansion works as intended, pushing the delegate ...
0
votes
1
answer
30
views
Input.GetKey(sprintKey) is toggling off and on every frame?
I am currently working on a sprint function for my first person controller.
My setup is a "PlayerMovementController", a "PlayerStatusController" and a Scriptable Object "...
-1
votes
0
answers
66
views
I'm getting this error: Cannot invoke "brave.Span.name(String)" because "this.delegate" is null
I've spent several days trying to mock "brave.Tracer" as below to get "brave.Span" when the code calls "tracer.currentSpan();"
I´m using
io.zipkin.brave:brave:5.13.9
org....
1
vote
0
answers
30
views
Set checkbox indicator width or bg color within custom QStyledItemDelegate.paint()
I have a QTableView, and a custom QStyledItemDelegate for some of the columns so that they display a centered checkbox. It works, but the checkbox's indicator (the border, basically) is thin and hard ...
1
vote
3
answers
58
views
How to invoke methods with arguments for any return and argument type?
I'm developing a scripting engine for an embedded system automation project. One requirement to accomplish this is to store instructions sequentially to be run later. The project also has to be in C#.
...
0
votes
0
answers
20
views
Adding a Context Menu to a dataGridView
VS2019 .NET 4.62
I couldn't figure out all of the examples and finally horsed my way to a working solution.
But, surely, there is a better way to do this?
When I use a delegate in other modes I am ...
0
votes
0
answers
24
views
Autofac delegate factory with optional parameters
I am trying to create a delegate factory in autofac that allows for some parameters to be avoided. My idea is to register a class with registration parameters and be able to override it in the ...
-1
votes
2
answers
53
views
C++/CLI from typedef std::function to managed delegate
I have a big class from extern library and I need to use a unmanaged callback in managed code.
Unmanaged code simplified:
typedef std::function<void(const std::string &, Float)> ...
2
votes
1
answer
67
views
How to pass delegates from Unity C# to a native Kotlin Android SDK?
I have a native Android library I'm integrating into Unity which require me to pass C# delegates to the native SDK. As a design decision, I'm passing functions to the native SDK to be called when ...
0
votes
1
answer
149
views
Center a Checkbox Delegate in QTableView with PySide6
I was using a Checkbox Delegate in my QTableView originally created from around the time of PyQt 4.8 or PySide 1.2.1. It was also working in PySide2, but when I tried to update my application to ...
1
vote
1
answer
73
views
Delegating function variables in Kotlin with generic class
I'm currently working on an application that requires delegating function variables. I've encountered some problems when trying to do so. Here's the code of a minimal reproducible example:
package org....
0
votes
0
answers
37
views
MSBuild Custom Task Failing to Load Dependency in Target Project
The Objective
I am writing a custom MSBuild task to handle Azure deployments locally (instead of Azure CLI, Azure Powershell, etc.). The task is using the Azure Resource Manager client library. Once ...