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 8993629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:14:02+00:00 2026-06-15T23:14:02+00:00

I just wondered, how the exact syntax is for ref and out parameters for

  • 0

I just wondered, how the exact syntax is for ref and out parameters for delegates and inline lambda functions.

here is an example

if a function is defined as

 public void DoSomething(int withValue) { } 

a delegate in a function can be created by

 public void f()
 {   
     Action<int> f2 = DoSomething;
     f2(3);
 }

how is that syntax, if the original function would be defined as

 public void DoSomething(ref int withValue) { withValue = 3; } 
  • 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-06-15T23:14:03+00:00Added an answer on June 15, 2026 at 11:14 pm

    You need to define a new delegate type for this method signature:

    delegate void RefAction<in T>(ref T obj);
    
    public void F()
    {
        RefAction<int> f2 = DoSomething;
        int x = 0;
        f2(ref x);
    }
    

    The reason why the .NET Framework does not include this type is probably because ref parameters are not very common, and the number of needed types explodes if you add one delegate type for each possible combination.

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

Sidebar

Related Questions

I just wondered how it is possible to write a user-defined square root function
Here's an example of PTT app https://itunes.apple.com/us/app/iptt-push-to-talk/id311931218?mt=8 I just wondered how it works ?
I just wondered if there were an native PHP function that would replicate the
I have created a fiddle here, and just wondered how to go about centering
i just wondered if there are any alternative tools out there like Pex for
Just wondered if anyone could point me in the right direction here? I'm trying
Just wondered if any LINQ guru might be able to shed light on how
I just wondered, why most Delphi examples use FillChar() to initialize records. type TFoo
I just wondered if there are any libraries in Java or any other language
I just wondered if anybody can point me in the right direction: I'm looking

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.