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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:33:50+00:00 2026-05-31T20:33:50+00:00

For a remoting framework, I need to keep some metadata about object that I’m

  • 0

For a remoting framework, I need to keep some metadata about object that I’m returning.
I have no control over the object themselves (so I can’t make them IDisposable), I also don’t know their type. my only assumption is that it’s a reference type.

The problem is life time, when do I free my metadata.

I intend to create a static dictionary(ConcurrentDictionary) and hold there a WeakReference to the object, and the metadata. The question is, how do i know when to delete the metadata?
is there a way to receive a notification when the object itself is finalized?

Also i don’t care about necromancy (object resurrection)

Thank you

  • 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-31T20:33:51+00:00Added an answer on May 31, 2026 at 8:33 pm

    If you’re using .NET4 or later you could possibly use ConditionalWeakTable<K,V>.

    This would mean that you (probably) wouldn’t need to worry about freeing-up the metadata yourself: it would just disappear from the table once the object itself was gone.

    The ConditionalWeakTable<TKey, TValue> class differs from other
    collection objects in its management of the object lifetime of keys
    stored in the collection. Ordinarily, when an object is stored in a
    collection, its lifetime lasts until it is removed (and there are no
    additional references to the object) or until the collection object
    itself is destroyed. However, in the ConditionalWeakTable<TKey,
    TValue>
    class, adding a key/value pair to the table does not ensure
    that the key will persist, even if it can be reached directly from a
    value stored in the table (for example, if the table contains one key,
    A, with a value V1, and a second key, B, with a value P2 that contains
    a reference to A). Instead, ConditionalWeakTable<TKey, TValue>
    automatically removes the key/value entry as soon as no other
    references to a key exist outside the table.

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

Sidebar

Related Questions

I have some .NET remoting code where a factory method, implemented in some server
I miss the .Net remoting days when I could just send an object over
I have a remoting server hosted under IIS that is throws the following exception
I have a large .NET remoting project using the 2.0 framework. The server's API
I have a common GWT application that is using (trying to) Rocket-Framework to implement
Does silverlight support the remoting functionality of the .net framework?
I have converted an Entity framework project to use POCO objects by removing the
We have a remoting singleton server running in a separate windows service (let's call
I am using .Net Remoting and trying to access a remote object modified in
I am revamping a website that (now) uses Prototype framework. In the process of

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.