本文整理汇总了C#中Construct.GetValues方法的典型用法代码示例。如果您正苦于以下问题:C# Construct.GetValues方法的具体用法?C# Construct.GetValues怎么用?C# Construct.GetValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Construct
的用法示例。
在下文中一共展示了Construct.GetValues方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateMonthly
internal void CreateMonthly(Construct wts_, Technicals.ProductBase[] products_)
{
List<DateTime> dates = new List<DateTime>();
List<double> vals = new List<double>();
int countOfZerosThisMonth = 0;
int numberOfRebalsThisMomth = 0;
int currentMonth = 0;
int currentYear = 0;
for (int i = 0; i < wts_.Dates.Count; ++i)
{
if (wts_.Dates[i].Year != currentYear || wts_.Dates[i].Month != currentMonth)
{
if (currentMonth != 0)
{
dates.Add(new DateTime(currentYear, currentMonth, 1));
vals.Add(Convert.ToDouble(countOfZerosThisMonth) / Convert.ToDouble(numberOfRebalsThisMomth));
}
countOfZerosThisMonth = 0;
numberOfRebalsThisMomth = 0;
}
double[] weightsThisRebal = wts_.GetValues(wts_.Dates[i]);
for(int y=0;y<weightsThisRebal.Length;++y)
if (weightsThisRebal[y] == 0.0 && products_[y].IsValid(wts_.Dates[i]))
++countOfZerosThisMonth;
++numberOfRebalsThisMomth;
currentMonth = wts_.Dates[i].Month;
currentYear = wts_.Dates[i].Year;
}
dates.Add(new DateTime(currentYear, currentMonth, 1));
vals.Add(Convert.ToDouble(countOfZerosThisMonth) / Convert.ToDouble(numberOfRebalsThisMomth));
foreach (DateTime date in dates)
dt.Columns.Add(date.ToString("MMM yy"), typeof(double));
DataRow row = dt.NewRow();
for (int i = 0; i < vals.Count; ++i)
row[i] = vals[i];
dt.Rows.Add(row);
Chart.DataSource = dt;
}