Re: Controlling Objects

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Nicholas Paldino [.NET/C# MVP] (mvp_at_spam.guard.caspershouse.com)
Date: 03/24/05


Date: Thu, 24 Mar 2005 11:50:48 -0500

FredC,

    I don't know what you mean by an object's health. An object doesn't
have a health. If you have a reference to it, you can call what you want.
It's not something you need to worry about.

    As for calling a specific object in a multiple object set, again, what
do you mean by this? Do you mean a specific object in the array? If that
is the case, you can just access the array through the indexer, and then
call the object like any other.

    The only case you have to worry about when you are done with an object
is if it implements the IDisposable interface. If it does, then you have to
make sure to call the implementation of Dispose on that instance when you
are done with the instance itself. Otherwise, you don't have to worry about
getting rid of objects. Just release your references (by setting to null in
class fields, or if a local variable, doing nothing), and you will be fine.

    Hope this helps.

-- 
               - Nicholas Paldino [.NET/C# MVP]
               - mvp@spam.guard.caspershouse.com
"FredC" <FredC@discussions.microsoft.com> wrote in message 
news:76CC2590-F530-46AF-8A83-9055A1FAB82D@microsoft.com...
> Given following code to instantiate object, how does one:
> 1) check a specific objects health - running, dead etc.
> 2) call a method in a specific object in the multiple object set
> 3) terminate a specific object
>
> foreach ( DataRow ConfigRow in DSWTG.Tables["TurbineConfiguration"].Rows )
> {
>      switch ( ConfigRow["Turbine Type"].ToString())
>      {
>            case "V47":
> // instantiate a new turbine
> VestasWTG V47 = new VestasWTG( TagNameRow, ConfigRow);
> break;
>            default:
> break;
>       }
> } 


Relevant Pages

  • Re: Canadian, and Other, Health Care
    ... someone opting out of health insurance because *they* don't see the need for ... I am happier knowing that I have a primary care dr...who has a full support ... worry when/where/which dr to see when I need one...in the end this saves the ... | I've HAD those bills, and I've known other people who've had them. ...
    (rec.arts.mystery)
  • Re: Warning newbies of the dangers due to the global object
    ... against the JS's object's ~ universal, unrestricted mutability: ... I don't worry so much about untrusted code getting a reference to an object, provided I gave it the object in the first place. ... That you shouldn't be worried about it because it's a lost battle. ...
    (comp.lang.javascript)
  • Just how bad are your health vices ???
    ... Alcohol Abuse and Alcoholism. ... Not surprisingly, one big worry ... will affect their well-being later in life. ... nagging health faux pas from your past. ...
    (sci.med)
  • Just how bad are your health vices ???
    ... Alcohol Abuse and Alcoholism. ... Not surprisingly, one big worry ... will affect their well-being later in life. ... nagging health faux pas from your past. ...
    (rec.music.hip-hop)
  • Re: mw blogs
    ... worry for your health. ... It's a perfectly straightforward request. ... I was even polite, ...
    (misc.writing)