PC Review


Reply
Thread Tools Rate Thread

Controlling Objects

 
 
=?Utf-8?B?RnJlZEM=?=
Guest
Posts: n/a
 
      24th Mar 2005
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;
}
}
 
Reply With Quote
 
 
 
 
Nicholas Paldino [.NET/C# MVP]
Guest
Posts: n/a
 
      24th Mar 2005
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]
- (E-Mail Removed)

"FredC" <(E-Mail Removed)> wrote in message
news:76CC2590-F530-46AF-8A83-(E-Mail Removed)...
> 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;
> }
> }



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Option group controlling objects Brian Microsoft Excel Programming 1 19th May 2010 05:20 PM
Controlling db objects from VBA (like Database Window) ? =?Utf-8?B?UGhpbGlw?= Microsoft Access VBA Modules 7 12th Jun 2007 08:03 AM
Creating and controlling objects in a UserForm Pierre Archambault Microsoft Excel Programming 1 24th Nov 2004 03:37 PM
Controlling drawing objects in Excel . . . Thaw Htin Oo Microsoft Excel Misc 1 21st Oct 2003 05:27 PM
Controlling position of objects in Reports McKeown NewsGroup Account Microsoft Access Reports 1 13th Oct 2003 04:36 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:02 AM.