Skip to main content
Filter by
Sorted by
Tagged with
0 votes
1 answer
43 views

Attempting to get rid of nested switch clauses but new to C# (Perhaps using Dictionary and Delegates) [closed]

Unity Game Engine has this nice methods to detect collisions: OnCollisionEnter OnCollisionStay OnCollisionExit All of them take a Collision object in order to implement logic on all of those cases. ...
Erparom's user avatar
  • 23
0 votes
1 answer
80 views

Godot C# : Signals, delegates and events

I don't know if it's a Godot limitation... I'm trying to declare some events in my C# file. When you write "[Signal]" before a delegate declaration in Godot, the engine declares the ...
Gustavo Henrique's user avatar
0 votes
0 answers
48 views

UE5 C++ event doesn't fire

For the last two days I've tried to figue out where's the real problem and I'm surely going crazy because everything seems fine and I didn't find any possible solution over the Internet. Basically I'm ...
Un tizio tizio's user avatar
0 votes
1 answer
30 views

How to require passed delegate invocation before function exit?

Over years of game development, I've found a common pattern to follow is to hand a function a delegate that it must execute upon completion of whatever that function needs to do, like a callback ...
Jake Muehle's user avatar
0 votes
1 answer
17 views

OnActorPreSpawnInitialization delegate broadcast is completely ignored after deployment on Android

Im running UE 5.3 I’ve created game instance subsystem C++ class which adds specific logic to be run before every spawned actor is initialized. Please see piece of code below. It works good when I run ...
Dron4K's user avatar
  • 474
0 votes
0 answers
26 views

I do not understand difference between multi-cast delegates and events [duplicate]

I can achieve everything which event can achieve using multi-cast delegate. you name it Can anyone explain with an example The only difference I can see is event keyword The most common answer I heard ...
chay's user avatar
  • 1
1 vote
1 answer
52 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()...
Bawenang Rukmoko Pardian Putra's user avatar
0 votes
1 answer
42 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 ...
Adel M.'s user avatar
  • 388
1 vote
2 answers
112 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, ...
Bogey's user avatar
  • 5,532
0 votes
0 answers
12 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 ...
Benjamin Gavrikovcky's user avatar
0 votes
1 answer
33 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 "...
archivenine's user avatar
1 vote
0 answers
45 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 ...
bernardlebel's user avatar
1 vote
3 answers
67 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#. ...
Breno's user avatar
  • 31
0 votes
0 answers
24 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 ...
Mike Sr's user avatar
  • 533
0 votes
0 answers
34 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 ...
elgato's user avatar
  • 535
-1 votes
2 answers
68 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)> ...
The Overrider's user avatar
2 votes
1 answer
83 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 ...
Minebomber's user avatar
  • 1,181
0 votes
1 answer
247 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 ...
CatamountJack's user avatar
1 vote
1 answer
83 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....
ttzytt's user avatar
  • 101
0 votes
0 answers
40 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 ...
Ken Garrett's user avatar
2 votes
1 answer
118 views

Why does Kotlin allow delegation to extension properties with no backing fields?

I understand why Kotlin doesn't allow initializing extension properties such as val SomeClass.anExtensionProperty = "can't do this" because there is no backing field to hold the value. And ...
J-bob's user avatar
  • 8,932
2 votes
1 answer
40 views

Run a function just after init() completes in Swift

I am testing to run delegation pattern from initializers. Here is my data supplier test class and its' data source : protocol MyClassDataSource : AnyObject{ func returnString(string: String) } ...
incelemeTRe's user avatar
1 vote
3 answers
90 views

Pass a delegate into servicecollection c# web API

I am trying to pass a method into a library from my calling API project. The library needs to receive a pointer to the method in a non-static class that has other dependencies. The library calls the ...
user900566's user avatar
1 vote
0 answers
95 views

Assigning Delegate to DataScannerViewController

I'm trying to implement a DataScannerViewController in my iOS app. I've created a delegate for it that's supposed to print when the user zooms in. The DataScannerViewController pushes as normal, but ...
APF's user avatar
  • 11
0 votes
0 answers
29 views

What is the purpose of the keyword "by" (property delegates) when declaring a MutableState<T> with remember? [duplicate]

Ok. So while I was working to my current Android Jetpack Compose project, I managed to get stuck on the following concept related to property delegates, more exactly the keyword "by". I've ...
jakeprog123's user avatar
1 vote
0 answers
87 views

How to dispose delegate in blazor or c#

Below I have attached my blazor code. private delegate Task keyActionDelegate(KeyboardEventArgs e); private KeyActionDelegate _keyActionDelegate; protected override async Task OnParametersSetAsync() {...
Vigneshwaran Govindharajan's user avatar
-1 votes
2 answers
64 views

What is the difference between "Action<object?, EventArgs>" and "EventHandler(object? sender, EventArgs e)"? [duplicate]

public delegate void Action<object?, EventArgs>(object? sender, EventArgs e); public delegate void EventHandler(object? sender, EventArgs e); What is the difference between those two lines? ...
Efe Belli's user avatar
0 votes
1 answer
52 views

Function pointer on generic class delegate

I need to get a FunctionPointerForDelegate to pass a native P/Invoke, but the function resides in a generic class of type myClass When I try to create the Pointer I get an error of System....
totalZero's user avatar
  • 335
-1 votes
1 answer
131 views

Unable to call main function in VS 2022

In VS 2022, the entry point of the code public static void main no longer exist. I was trying to implement a simple delegate but no output is shown on the console: using System; namespace ConsoleApp1 ...
user3209091's user avatar
1 vote
0 answers
43 views

Error when casting System.Action using contravariance in C#

I have an interface with an event with the sender as the argument. public interface IShootAttackChild { public event System.Action<IShootAttackChild> OnDestroy; /* and some functions */ }...
Szymek's user avatar
  • 21
0 votes
1 answer
134 views

Multiple instances using delegates in unity c#

I have created a delegate on a Script named BattleManager to handle the methods when the round is over. Everything seems to work just fine except when there are multiple instances of the same object ...
Saucyloco's user avatar
  • 303
0 votes
1 answer
29 views

initialization order with delegates and multiple view controllers is not working

I am trying to build a program where the MainController uses a delegate to pass data into a table inside TableViewController. I think I've initialized it correctly but LoadSN() does not trigger the ...
Hyperian's user avatar
  • 139
0 votes
1 answer
42 views

Delegate does not trigger method

I've looked at other delegate questions but there weren't any good existing answers. Everything should be set up properly, I can see my slider will change value in logs. For some reason, the delegate ...
Hyperian's user avatar
  • 139
0 votes
0 answers
20 views

Persuading Kestrel to log my preferred handler name instead of "Wrapper"

I have a dot-net web service set up as follows: using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Http; var app = WebApplication.Create(); app.Urls.Add("http://localhost:3001");...
billpg's user avatar
  • 3,283
0 votes
0 answers
39 views

If I have an inline expression, will all references to that expression be the same for the lifetime of an application?

So I have some code that filters a foo by primary key and applies a transformation public T GetFooByIdAndApplyTransformation<T>(int fooID, func<Foo,T> transformation) { return ...
Sidney's user avatar
  • 696
0 votes
1 answer
254 views

Memory Leak caused by Roslyn, how do I contain it?

So I have this NET6.0 console application that acts as a sort of bridge between other apps for UDP messages. To define how to send data out of my application have this profile system that consists in ...
MrBott_a's user avatar
1 vote
1 answer
99 views

Delegate to an instance method cannot have null 'this' discord.net [duplicate]

I am developing a C# program in .NET 8 I have a generic host with a bunch of services for a discord bot. In one I have code like this (simplified code) public MessageService(DiscordSocketClient client,...
traso's user avatar
  • 21
0 votes
0 answers
48 views

QTreeView, how to use the enabled sibling column's background colour in disabled column in delegate paint method

I am using Qt 6.5. I am facing issue to set the background colour of a disabled column in a QTreeView for 3 conditions when the row is selected, hovered and hovered on top of the already selected ...
User1212's user avatar
1 vote
2 answers
98 views

What is meant by "instance method closed over its first argument" in the C# Delegate class documentation

I'm currently working through the documentation of the Delegate class in C# and am running into some terminology that is tripping me up. I have a conceptual understanding of what a delegate is coming ...
Acadian_Ghost's user avatar
0 votes
0 answers
52 views

Is it possible in C# to declare a delegate type in which the input parameters are dynamic but the return type is not? [duplicate]

I am in .NET 6.0. I have a class, we'll call him "ComplexObject". ComplexObject has some complex/dynamic data structures under the hood [that aren't relevant to the question], and the best ...
Donald.Record's user avatar
4 votes
0 answers
168 views

Why can't C# infer the type of anonymous delegates/functions in some cases?

I'm using C# 12. When assigning a function to an implicitly-typed (var) variable, C# can infer the type successfully, such as in this example: // Scenario A var func = () => "Hello World";...
user3163495's user avatar
  • 3,357
0 votes
0 answers
55 views

java.lang.IllegalArgumentException: None of [] allows for delegation from cle.application.page.applicationui.BasePage.isDisplayed()

Caused by: java.lang.IllegalArgumentException: None of \[public static java.lang.Object net.thucydides.core.steps.ProxyConfiguration$InterceptorDispatcher.intercept(java.lang.Object,java.lang.reflect....
mohanapriya subramanian's user avatar
0 votes
0 answers
44 views

Delegate on Delegate

I have a situation: I have a SideMenu and there is a Logout button on it. After the logout is triggered, 2 things are to be done: try Auth.auth().signOut() is to be done in Firebase self....
Mr.Schtelbe's user avatar
0 votes
1 answer
70 views

null event += doesn't cause an error. Why is this `null +=` not an error? [duplicate]

Running the following delegate void GreetDelegateType(); public class Program { static GreetDelegateType GreetDelegate; static event GreetDelegateType GreetEvent; static void ...
joseville's user avatar
  • 937
1 vote
1 answer
61 views

Getting "Operator '+' cannot be applied to operands of type 'method group' and 'method group'" when trying to chain delegatees (multicast delegate)

The following code public class TypeTests { delegate int LogMessageDelegate(string message); int LogMessageToConsoleReturn1(string msg) { Console.WriteLine($"{msg} return 1&...
joseville's user avatar
  • 937
0 votes
1 answer
54 views

Use delegate from multiple classes and methods

How can I send values between different methods from other classes? I have different classes which controls products on a website. So I have a classes for products, categories, images etc. From the ...
Paul Albers's user avatar
0 votes
1 answer
45 views

Can't store a method from another class inside a delegate in another class when that clas is instantiating

I have a method in a class that I want to add as a listener to a button that I'm gonna instance soon. I'm using a PopUpManager that queues PopUp classes and instantiates them as they go and in a PopUp ...
Kureyş Alp Kılıç's user avatar
0 votes
2 answers
117 views

In C#, how do I replace a Func with a delegate in a function parameter?

Looking at the following function that expects another Function with an output type T and simply calls it at returns the result: T CallFunction<T>(Func<T> lambda) { return lambda(); } I ...
dan-kli's user avatar
  • 731
0 votes
0 answers
43 views

Why is using DispatcherTimer and not unregister Event causing a MemoryLeak? [duplicate]

I have created a WPF-Window. There I use a DispatcherTimer to refresh a label: DispatcherTimer timer; public Clock() { InitializeComponent(); timer = new DispatcherTimer { Interval = ...
BennoDual's user avatar
  • 6,239
2 votes
1 answer
173 views

How to correctly share a ViewModel Delegate between different ViewModels?

In my app I have a ViewModel Delegate that is shared between some ViewModels of mine (in the span of a Navigation Graph). Example: A ViewModelDelegate that fetches the filter items only once and ...
Augusto Carmo's user avatar

1
2 3 4 5
228