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

The Archive Base Latest Questions

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

I am fairly new to learning C# (from Java & C++ background) and I

  • 0

I am fairly new to learning C# (from Java & C++ background) and I have a question about manual garbage disposal: is it even possible to manually destroy an object in C#? I know about the IDisposable interface, but suppose I’m dealing with a class which I didn’t write and it doesn’t implement it? It wouldn’t have a .Dispose() method, so that and using { } is out, and .Finalize is always either protected or private so that’s not an option either.

(I am just trying to learn what is possible in C# in this case. I suppose if all else fails I could inherit the hypothetical ImNotDisposable class so that it does implement IDisposable.)

  • 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-13T08:10:22+00:00Added an answer on May 13, 2026 at 8:10 am

    You don’t manually destroy .Net objects. That’s what being a managed environment is all about.

    In fact, if the object is actually reachable, meaning you have a reference you can use to tell the GC which object you want to destroy, collecting that object will be impossible. The GC will never collect any object that’s still reachable.

    What you can do is call GC.Collect() to force a general collection. However, this almost never a good idea.

    Instead, it’s probably better to simply pretend any object that doesn’t use unmanaged resources and is not reachable by any other object in your program is immediately destroyed. I know this doesn’t happen, but at this point the object is just a block of memory like any other; you can’t reclaim it and it will eventually be collected, so it may just as well be dead to you.

    One final note about IDisposable. You should only use it for types that wrap unmanaged resources: things like sockets, database connections, gdi objects, etc, and the occasional event/delegate subscription.

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

Sidebar

Ask A Question

Stats

  • Questions 501k
  • Answers 501k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Use $valid->getMessages() to find out what happened if ($valid->isValid($_FILES['file']['name']){ //… May 16, 2026 at 2:14 pm
  • Editorial Team
    Editorial Team added an answer You could do this. (If you are on SQL Server… May 16, 2026 at 2:14 pm
  • Editorial Team
    Editorial Team added an answer I have figured this out now. You have to use… May 16, 2026 at 2:14 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I'm fairly new to programming and from learning I have seen different ways of
I am fairly new to Objective-C. Currently porting my own library from C#/Java to
I am still fairly new to EDI, and learning it on a new job.
My company is fairly new to unit testing our code. I've been reading about
so i have a program i am developing and as im fairly new to
I have a contract in the offering from a client to develop an intranet
I'm fairly new to Lua, I've been working on trying to implement Lua scripting
Fairly new to iPhone app development, so this might be really obvious (if so,
Fairly new to jQuery and JavaScript in general. I mocked up an example of
I am fairly new to SSAS and SQL Server but Google didn't help. I

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.