まず第一に、私はプログラミングに興味がありませんが、私のニーズに合わせて基本的な概念を理解することができました.
以下のコードでは、「Gold」という名前でプロパティを次のように設定します。
_cotreport.Contract = COTReportHelper.ContractType."Blabalbal"
protected override void OnBarUpdate()
{
COTReport _cotreport = COTReport(Input);
_cotreport.Contract=COTReportHelper.ContractType.Gold;
_cotreport.OpenInterestDisplay=COTReportHelper.OpenInterestDisplayType.NetPosition;
double index = _cotreport.Commercial[0];
OwnSMA.Set(index);
}
以下のコードを試してみましたが、システムは次のように言っています: "
オブジェクト参照がオブジェクト インスタンスに設定されていません"
助けてください!
System.Reflection.PropertyInfo PropertyInfo = _cotreport.GetType().GetProperty("ContractType");
PropertyInfo.SetValue(_cotreport.Contract,"Gold",null);
PropertyInfo.SetValue(_cotreport.Contract,Convert.ChangeType("Gold",PropertyInfo.PropertyType),null);