本文整理汇总了C#中Period.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Period.ToString方法的具体用法?C# Period.ToString怎么用?C# Period.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Period
的用法示例。
在下文中一共展示了Period.ToString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetMetrics
private IList<metrics> GetMetrics(List<string> metrics, DateTime startDate, DateTime endDate, Period period,
bool isAsync, GetMetricsCallback callback, Object state)
{
var parameterList = new Dictionary<string, string> {{"method", "facebook.admin.getMetrics"}};
Utilities.AddRequiredParameter(parameterList, "start_time", DateHelper.ConvertDateToFacebookDate(startDate).ToString());
Utilities.AddRequiredParameter(parameterList, "end_time", DateHelper.ConvertDateToFacebookDate(endDate).ToString());
Utilities.AddRequiredParameter(parameterList, "period", period.ToString("D"));
Utilities.AddJSONArray(parameterList, "metrics", metrics);
if (isAsync)
{
SendRequestAsync<admin_getMetrics_response, IList<metrics>>(parameterList, !string.IsNullOrEmpty(Session.SessionKey), new FacebookCallCompleted<IList<metrics>>(callback), state, "metrics");
return null;
}
var response = SendRequest<admin_getMetrics_response>(parameterList, !string.IsNullOrEmpty(Session.SessionKey));
return response == null ? null : response.metrics;
}
示例2: ToString_AllUnits
public void ToString_AllUnits()
{
Period period = new Period(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
Assert.AreEqual("P1Y2M3W4DT5H6M7S8s9t10n", period.ToString());
}
示例3: getMetrics
/// <summary>
/// Returns specified daily metrics for your application, given a date range.
/// </summary>
/// <returns></returns>
public IList<metrics> getMetrics(List<string> metrics, DateTime startDate, DateTime endDate, Period period)
{
var parameterList = new Dictionary<string, string> {{"method", "facebook.admin.getMetrics"}};
_api.AddRequiredParameter(parameterList, "start_time", DateHelper.ConvertDateToDouble(startDate).ToString());
_api.AddRequiredParameter(parameterList, "end_time", DateHelper.ConvertDateToDouble(endDate).ToString());
_api.AddRequiredParameter(parameterList, "period", period.ToString("D"));
_api.AddJSONArray(parameterList, "metrics", metrics);
var response = _api.SendRequest(parameterList);
return !string.IsNullOrEmpty(response) ? admin_getMetrics_response.Parse(response).metrics : null;
}