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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T10:26:40+00:00 2026-05-15T10:26:40+00:00

Sorry if this question is too simple or easy. I just started studying Delegates

  • 0

Sorry if this question is too simple or easy.

I just started studying Delegates using C#. When I tried to declare one inside a function I got design time errors, but when I declare the same Delegate at class level, it works fine. Why?

If matters this is the code: delegate void Test();

  • 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-15T10:26:40+00:00Added an answer on May 15, 2026 at 10:26 am

    AFAIK, declaring a delegate like that (in C#, which I assume is the language you are using) is declaring a new type. Just as you cannot declare classes, structs, or interfaces in a method, you cannot declare this type.

    Edit: If you’re just learning delegates, and the language is indeed c#, consider using the Func templated delegate! It will save you from having declarations everywhere.

    http://msdn.microsoft.com/en-us/library/bb549151.aspx

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

Sidebar

Related Questions

Sorry for the unlearned nature of this question. If there's a simple answer, just
Sorry if this is too simple a question, but is there a sumif function
Sorry if this question is too vague, but I'd rather not muddy it's point
Sorry if this question will sound too chaotic, feel free to edit it. I
Sorry if this question is very easy, but I can't find the answer anywhere.
Question: Hello All, Sorry that this is kind of a noob question. I just
Sorry for this simple questions but i am too much confused with how to
Sorry if this is too noobish a question. Thank you for being patient... I'm
I'm sorry if this question is a dumb one, but I must ask. In
Sorry if this question seems stupid, but it's stumped me for a couple days,

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.