|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using YAXLib;
namespace DemoApplication.SampleClasses
{
[YAXComment("This example shows how to apply format strings to a class properties")]
public class FormattingExample
{
[YAXFormat("D")]
public DateTime CreationDate { get; set; }
[YAXFormat("d")]
public DateTime ModificationDate { get; set; }
[YAXFormat("F05")]
public double PI { get; set; }
[YAXFormat("F03")]
public List<double> NaturalExp { get; set; }
[YAXDictionary(KeyFormatString = "F02", ValueFormatString = "F05")]
public Dictionary<double, double> SomeLogarithmExample { get; set; }
public override string ToString()
{
return GeneralToStringProvider.GeneralToString(this);
}
public static FormattingExample GetSampleInstance()
{
List<double> lstNE = new List<double>();
for (int i = 1; i <= 4; ++i)
lstNE.Add(Math.Exp(i));
Dictionary<double, double> dicLog = new Dictionary<double, double>();
for (double d = 1.5; d <= 10; d *= 2)
dicLog.Add(d, Math.Log(d));
return new FormattingExample()
{
CreationDate = new DateTime(2007, 3, 14),
ModificationDate = DateTime.Now,
PI = Math.PI,
NaturalExp = lstNE,
SomeLogarithmExample = dicLog
};
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.