Page 1 of 1

System.Reflection.GetProperty not available?

Posted: Wed Dec 25, 2019 9:09 am
by gkimirti
When I want to use this script at the 2.40 sp4 version, that message appears.
_System.Reflection.GetProperty =_ System.Reflection.GetField Functionality changed that cannot be automatically converted. Needs manual overview_

mark.monroe 's code
http://ixtalk.beijerelectronics.us/down ... php?id=521

http://ixtalk.beijerelectronics.us/view ... y&start=10

I want to use , but get runtime error.

Code: Select all

		private GlobalDataItem GetGlobalDataItem(string propertyName)
		{
			PropertyInfo tagProperty = typeof(Neo.ApplicationFramework.Generated.Tags).GetProperty(propertyName);
			if(tagProperty == null)
				return null;
			else
				return tagProperty.GetValue(Globals.Tags, null) as GlobalDataItem;         
		}

Re: System.Reflection.GetProperty not available?

Posted: Wed Jan 08, 2020 12:32 pm
by Russ C.
As of iX Developer 2.20 that method is no longer supported, try FieldInfo instead, see below:

Code: Select all

using Neo.ApplicationFramework.Interfaces.Tag;
using System.Reflection;

private IBasicTag GetTag(string tagName)
{
   FieldInfo tagProperty = typeof(Neo.ApplicationFramework.Generated.Tags).GetField(tagName);
   return (IBasicTag)tagProperty.GetValue(Globals.Tags);
}