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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:28:17+00:00 2026-05-24T20:28:17+00:00

Class1: public class FunctionBlocks { List<Hashtable> _htLogicalNodeList; public FunctionBlocks() { _htLogicalNodeList = new List<Hashtable>();

  • 0

Class1:

      public class FunctionBlocks
      { 
          List<Hashtable> _htLogicalNodeList;   
          public FunctionBlocks()
          { 
            _htLogicalNodeList = new List<Hashtable>();
            FunctionBlock fb = new FunctionBlock();
            fb.AddDODASignalList(new Hashtable);            
            _htLogicalNodeList.Add(fb.LogicalNodeHash);     
            fb = null;
          }     
      }

Class2:

      public class FunctionBlock
      {
        Hashtable _htLogicalNode;

        public FunctionBlock()
        {
            _htLogicalNode = new Hashtable();
        }

        public Hashtable LogicalNodeHash
        {
            get{return _htLogicalNode;}
            set{_htLogicalNode = value;}
        }

        public void AddDODASignalList(Hashtable doDASignal)
        {
            _htLogicalNode.Add(doDASignal);
        }
     }

In this example I wan’t to dispose “_htLogicalNode” . “fb” object I have make it as null ,Eventhough “FunctionBlocks” instance have “_htLogicalNode” references. How I can dispose “_htLogicalNode” instance.

  • 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-24T20:28:20+00:00Added an answer on May 24, 2026 at 8:28 pm

    What do you mean by “dispose”? You could have FunctionBlock implement IDisposable in which case you could use the following:

    using (FunctionBlock fb = new FunctionBlock())
    {
        fb.AddDODASignalList(new Hashtable);            
        _htLogicalNodeList.Add(fb.LogicalNodeHash);     
    }
    

    However I can’t see anything in FunctionBlock that needs disposing, and so doing this would be pointless – the IDisposable interface / pattern is essentially just a fancy / robust way of calling a method when you are done with an object. Unless you do something in the implemented Dispose method then this does nothing.

    If by “dispose” you mean free up the memory then the answer is that you don’t need to do anything (you don’t even need to set fb to null). Simply let fb go out of scope and the garbage collector will collect it and free up the used memory in its own time.

    You may find that the memory used by fb is not freed immediately – this is perfectly normal and to be expected. There are ways of forcing the garbage collector into doing “its thing” when you want it to, but doing this is very bad practice.

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

Sidebar

Related Questions

Supposing I have this code public class Class1 { List<Class2> myClass2List = new List<Class2>;
public class Class1 { public Class1() { prop = new Class2(); } public Class2
Option Explicit On Option Strict On Public Class Class1 Dim l As List(Of A)
Assume the following class: public class MyEnum: IEnumerator { private List<SomeObject> _myList = new
For example: Public Class Class1 Public Sub Some() Dim Image As New Bitmap(C:\image.bmp) End
Are these two statments equivalent? Public Class Class2(Of X As Class1) Public Class Class2(Of
Consider the following class public class Class1 { public int A { get; set;
I'm currently tempted to write the following: public class Class1() { public Class1() {
What are the cons of some code like this: public class Class1 { public
what would be the difference between this class Class1 { public string prop1 {

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.