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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:41:44+00:00 2026-05-31T01:41:44+00:00

I have a class. In c#, is there some way (which i can implement

  • 0

I have a class. In c#, is there some way (which i can implement in a static method) which can identify an object of this class, instantiated by some other (calling) class?

Scenario
Actually I have a class of Country, which contains a member Rectangle (having 4 coordinates). I want to write a static method which, when passed a point or vector2d, searches for that point in each of the instantiated objects of Country and can return ref of that object.
I have Rectangle.Contains(point) method which tells if that point lies in calling rectangle.

  • 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-31T01:41:45+00:00Added an answer on May 31, 2026 at 1:41 am

    You would have to store all instances of your class in a collection, and search the collection to find the specific object you need.

    You could make this collection a static member of your class, but it doesn’t need to be. It could instead be stored elsewhere as an ordinary member of another class. For example if you have a CountryFactory that you use to construct your Country objects then each time the factory constructs a country it could also store a reference to that country in a collection inside the factory.

    Remember also to remove the country from the collection when you no longer need it, otherwise it won’t be garbage collected (or use a WeakReference).

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

Sidebar

Related Questions

Is there some way to avoid this. I have a lot of classes that
I have a non-static C# class with some instance methods, which I need to
I have a License class.There are 50 boolean properties and some timestamp properties. I
So I have some class starting with #include <wchar.h> #include <stdlib.h> and there is
Basically I have some class objects, each with three properties. Once one class object
I have some logic, which defines and uses some user-defined types, like these: class
Is there a best-practice or common way in JavaScript to have class members as
I have a class called Path for which there are defined about 10 methods,
Is there a way in .NET to have a class property have a second
Is there a way to require that a class have a particular abstract member?

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.