whenever am trying to access the value of a property through reflection am getting a error like "System.ArgumentException: Get Method not found for 'XXXX' at System.Reflection.MonoProperty.Get". Am using Xamarin studio version 6.3 and property also declared as public only.
Model:
using System;
namespace XXXX.Core
{
public class ManufacturingParameters
{
public ManufacturingParameters()
{
}
private int oemCode;
public int OEMCode
{
get { return oemCode; }
set { oemCode = value; }
}
}
}
Ex Code:
ValueString = deviceInfoContentVC.devInfo.manufacturingParameters.GetType().GetProperty(ParamSchema.Key).GetValue(deviceInfoContentVC.devInfo.manufacturingParameters).ToString();
The above code works perfectly in Visual studio but not in xamarin studio.
But I can access the same property through below code:
ValueString = deviceInfoContentVC.devInfo.manufacturingParameters.oemCode.ToString();
Since i wanted to access it dynamically i need reflection kind of mechanism.
Is there any alternative solution/fix for this?
Thank You.
Aucun commentaire:
Enregistrer un commentaire