当前位置: 首页>>代码示例>>C#>>正文


C# ConstructGen.DisplayInDataCollectionDisplay方法代码示例

本文整理汇总了C#中ConstructGen.DisplayInDataCollectionDisplay方法的典型用法代码示例。如果您正苦于以下问题:C# ConstructGen.DisplayInDataCollectionDisplay方法的具体用法?C# ConstructGen.DisplayInDataCollectionDisplay怎么用?C# ConstructGen.DisplayInDataCollectionDisplay使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ConstructGen的用法示例。


在下文中一共展示了ConstructGen.DisplayInDataCollectionDisplay方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Go


//.........这里部分代码省略.........

      // we get it out by:

      var v1 = firstConstruct.GetValue(conDate, 0);

      // set the second value:

      firstConstruct.SetValue(conDate, 1, 45.6);

      // this has set the value for the given date for 'CAD'

      // we could set all values at once using SetValues rather than SetValue

      firstConstruct.SetValues(conDate, new double[] {1, 2, 3, 4, 5, 6, 7, 8, 9});

      // and we could get them out using:

      double[] allValuesOnDate = firstConstruct.GetValues(conDate);

      // there are lots of methods on Construct<T> to make our life easier when dealing with data

      // we can fill it up randomly using the SetValues, and then just call SortKeys() to ensure teh dates are in order

      firstConstruct.SortKeys();

      // this means that we will be iterate over the dates in order when we go through it

      // e.g.

      foreach (DateTime date in firstConstruct.Dates)
      {
        var datesVAlues = firstConstruct.GetValues(date);

        // here we could process them...
      }

      // there are methods on ConstructGen<T> to make it easy to see what's in it.  e.g.

      firstConstruct.DisplayInGrid("Grid of construct values");
      firstConstruct.DisplayInDataCollectionDisplay("Display each column as a line in a chart");

      // there is also a useful method to get the column of values as a DatedDataCollection<T>

      DatedDataCollectionGen<double> firstColumn = firstConstruct.GetColumnValuesAsDDC(0);

      // this is an expensive operation FYI, so you wouldn't use this iterating over the dates within the ConstructGen<T> , but it is useful

      
      // ok, now, as we have a set universe of ccys, in the way I extract data from the database (prices / weights / carry / etc) I tend to pull
      // out in a standard way, making a ConstructGen<double> with a column for every currency in the universe

      // so, for example, if I wanted the spots from the database from 2013 onwards, I would call this

      SI.Data.FXSpots spotsProvider = new FXSpots();

      ConstructGen<double> spots = spotsProvider.GetData(new DateTime(2013, 1, 1), DateTime.Today);

      // this returns me a ConstructGen<double> with 27 columns, with each row being a date 

      // I can then use the spots values as I wish

      // similarly

      SI.Data.FXForwards1Wk fwdProvider = new FXForwards1Wk();

      ConstructGen<double> fwds = fwdProvider.GetData(new DateTime(2013, 1, 1), DateTime.Today);

      // within these classes, the data is cached, so that I don't call the database again if I don't need to

      // so if I call for the second time:

      var spots2 = spotsProvider.GetData(new DateTime(2013, 1, 1), DateTime.Today);

      // ... this won't have hit the database again, but will get from the cached data

      // but you'll notice that i have to have a reference to spotsProvider to benefit from the cached data.
      // if I was to make the same request from another point in my code, I would have to create a new FXSpots() instance and then call the method on it to get the data

      // it can be useful in this instance to make use of what's known as the 'Singleton' pattern.
      // This basically provides a means of referring to the same instance every time, in this case so that we make use of cached data

      // I have a Singleton<T> wrapper that wraps up a single instance of T so that I know I'm calling methods on the same instance every time

      // so I would usually get spots from the database wrapping FXSpots in this.  like:

      spots = Singleton<FXSpots>.Instance.GetData(new DateTime(2013, 1, 1), DateTime.Today);

      // now I could call the method on Singleton<FXSpots>.Instance from anywhere in my code and I would benefit from the caching

      // I do tend to use most of the classes that retrive from the database Within SI.Data wrapped in a Singleton

      // another example is the class that pulls information about signals

      var signals = Singleton<Signals>.Instance;

      // this is just a list of SI.Data.Signal classes

      

    }
开发者ID:heimanhon,项目名称:researchwork,代码行数:101,代码来源:L1.cs


注:本文中的ConstructGen.DisplayInDataCollectionDisplay方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。