07-24-2018 06:00 PM
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.
07-25-2018 06:28 PM
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.
05-30-2019 02:31 PM
For anyone looking for the PropertyValueTypes value, do the following:
variable.Type.ValueType