Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6325357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T16:52:51+00:00 2026-05-24T16:52:51+00:00

I have an Action delegate declared like this. private readonly Action<List<PSDPoint>[]> _psdAction; _psdAction =

  • 0

I have an Action delegate declared like this.

private readonly Action<List<PSDPoint>[]> _psdAction;
_psdAction = AddPSDData;

PSDPoint is a very simple class.

public class PSDPoint
{
    public int Frequency { get; set; }
    public double Power { get; set; }
}

I am attempting to call the delegate like this.

private void PSDData(object sender, PSDEventArgs e)
{
    Dispatcher.Invoke(_psdAction, e.Data);
}

PSDEventArgs looks like this. You can see e.Data is the same data type.

public class PSDEventArgs
{
    public List<PSDPoint>[] Data { get; set; }
    public string[] Channels { get; set; }
}

_psdAction points to this function. I never reach this code.

private void AddPSDData(List<PSDPoint>[] data)
{
    ...
}

I get this error the dispatcher is attempting to invoke. I can’t figure out why. I’m passing in the right type. I’m guessing it’s something “funky” with having an array of Lists?

Object of type 'System.Collections.Generic.List`1[DataLogger.Model.PSDPoint]' cannot be converted to type 'System.Collections.Generic.List`1[DataLogger.Model.PSDPoint][]'.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T16:52:52+00:00Added an answer on May 24, 2026 at 4:52 pm

    Try the following

    Dispatcher.Invoke(_psdAction, (object)e.Data);
    

    The problem is that the second parameter of Invoke takes a params object[]. The intent of this is to support delegates with variable number of arguments. The contents of the array are mapped to parameters. First element going to the first parameter, second element to the second parameter and so on.

    When you call it with e.Data the C# compiler sees an array. Instead of passing the array as the first argument it tries to pass each element as a parameter. By casting to object you can force the compiler to interpret it as a single parameter

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an action like this: public class News : System.Web.Mvc.Controller { public ActionResult
I have written a helper class which uses the Action - delegate as method
I have a method that was declared like this: public ButtonObject CreateStandardButton(type1 arg1, type2
I have a class with a constructor that looks like this: public TimedWorker(int timerInterval,
I have an action called List that shows the results of a search. It
i have form action file in another directory but some file send to this
I have this: ThreadPool.QueueUserWorkItem(new WaitCallback(FireAttackProc), fireResult); and FireAttackProc: private void FireAttackProc(Object stateInfo) { //
I have a delegate: delegate ResultType Caller<ResultType>(IPtxLogic logic); Here is a function: private ResultType
I have a delegate for my table view, and would like to be able
Here is the code: class LongOp { //The delegate Action longOpDelegate = LongOp.DoLongOp; //The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.