NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the Property Value Type - C#

Hi to everybody I am using C# to automate some tasks but I dont have much time using it. I am trying to get the type of a fileglobal variable, I am expecting to get this: http://zone.ni.com/reference/en-XX/help/370052N-01/tsapiref/reftopics/obsolete_propertyobject_gettyp....

 

Currently I have arrived to the point when I have a property object of the variable and I am trying to get the type, the code is below:

 

// Get a reference for the current variable object
PropertyObject variable = Seqref.FileGlobalsDefaultValues.GetPropertyObjectByOffset(Index, 0);

 

PropertyObjectType VarType = variable.Type.GetType();

 

But Visual Studio remarks the next error:

Cannot implicitly convert type 'System.Type' to 'NationalInstruments.TestStand.Interop.API.PropertyObjectType'. An explicit conversion exists (are you missing a cast?)

 

Am I doing something wrong? Your help will be appreciated.

0 Kudos
Message 1 of 3
(3,655 Views)

I think you can just get rid of the GetType() on the end there.

 

PropertyObject.Type will return a PropertyObjectType.

 

GetType() returns a PropertyValueTypes which isn't the same thing.  It is an enum.

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 2 of 3
(3,627 Views)

For anyone looking for the PropertyValueTypes value, do the following:

 

variable.Type.ValueType

0 Kudos
Message 3 of 3
(3,410 Views)