Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- enum Tag
- {
- Name, Date, //There are many more
- }
- class RequestDictionary : Dictionary<Tag, string>
- {
- }
- enum Tag
- {
- Name, Date
- }
- interface ITags
- {
- string Name { get; set; }
- DateTime Date { get; set; }
- }
- class RequestDictionary : Dictionary<Tag, string>, ITags
- {
- public ITags Tags { get { return this; } }
- string ITags.Name
- {
- get { return this[Tag.Name]; }
- set { this[Tag.Name] = value; }
- }
- DateTime ITags.Date
- {
- get { return DateTime.ParseExact(this[Tag.Date], API_DATE_FORMAT, CultureInfo.InvariantCulture); }
- set { this[Tag.Name] = value.ToString(API_DATE_FORMAT); }
- }
- }
- dict[Tag.Date] = DateTime.Now.ToString(API_DATE_FORMAT);
- dict.Tags.Date = DateTime.Now;
- var dict = new RequestDictionary
- {
- Tags.Date = DateTime.Now
- }
- var dict = new RequestDictionary
- {
- { Tags.Date, DateTime.Now.ToString(API_DATE_FORMAT) }
- };
Add Comment
Please, Sign In to add comment