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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T20:01:10+00:00 2026-05-13T20:01:10+00:00

what could be a possible use of declaring types within a namespace but not

  • 0

what could be a possible use of declaring types within a namespace but not in a class.

For ex:

namespace Test
{
    public delegate void Ispossible();
}

This is valid & does not generate any compilation errors but i can’t think of why we would declare it this way as opposed to inside a class.

  • 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-13T20:01:10+00:00Added an answer on May 13, 2026 at 8:01 pm

    A namespace is a high-level unit of organization within .NET.

    Declaring types within classes is typically frowned upon (but, as with all things, it’s not a 100% rule) because it can make the types more tightly coupled and more difficult to find.

    VB.NET Modules are somewhat of an exception (edit: they’re really more of a compiler trick/syntactical-sugar), but normally everything in the .NET ecosystem is contained in a namespace.

    Your example lends itself to reuse; if it were within a class then it would imply that delegate should only be used by that class and would likely lead to duplicate delegates needlessly being introduced.


    Update: When working with only a handful of types namespaces don’t seem of much use, but without them a project of any size would be an organizational catastrophe. Imagine the .NET framework without namespaces, one (probably long outdated) count puts the framework at 3500 Types.

    Namespaces are like folders or drawers for documents; a few loose papers are easy to manage but if you have many pages then finding the one you need becomes painful.

    Give the documentation a read, it’s short and not terribly complicated (neither are namespaces) but has a couple decent points MSDN – Namespace (c#)

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

Sidebar

Related Questions

What could be the possible causes for the following exception? System.PlatformNotSupportedException: 'ResourcePool' is not
What is the correct type to use for declaring a metavariable that possibly could
Is it possible to use CriteriaQuery with JPA 1.0. I guess JPA 2.0 not
In C++ is it possible to use another base class to provide the implementation
In C++ it is possible to use the static keyword within a translation unit
could you please tell me if it's possible de use a selector like that
Possible Duplicate: Could you explain STA and MTA? All ThreadPool threads are in the
Is it possible to access the Abstract Syntax Tree(AST) inside the javac.exe programmatically? Could
Possible Duplicate: How do I calculate someone's age in C#? Maybe this could be
How do you do it, or is it even possible? I suppose you could

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.