Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dictionary<Pair<string, int>, object>
- Dictionary<Triple<string, int, int>, object>
- int id = 33;
- string description = "This is a custom solution";
- DateTime created = DateTime.Now;
- KeyValuePair<int, KeyValuePair<string, DateTime>> triple =
- new KeyValuePair<int, KeyValuePair<string, DateTime>>();
- triple.Key = id;
- triple.Value.Key = description;
- triple.Value.Value = created;
- KeyValuePair<KeyValuePair<KeyValuePair<string, string>, string>, string> quadruple =
- new KeyValuePair<KeyValuePair<KeyValuePair<string, string>, string>, string>();
- KeyValuePair<KeyValuePair<KeyValuePair<KeyValuePair<string, string>, string>, string>, string> quintuple =
- new KeyValuePair<KeyValuePair<KeyValuePair<KeyValuePair<string, string>, string>, string>, string>();
- struct Pair<T, R>
- {
- private T first_;
- private R second_;
- public T First
- {
- get { return first_; }
- set { first_ = value; }
- }
- public R Second
- {
- get { return second_; }
- set { second_ = value; }
- }
- }
- public struct Pair<T1, T2>
- {
- public T1 First;
- public T2 Second;
- }
- public struct Triple<T1, T2, T3>
- {
- public T1 First;
- public T2 Second;
- public T3 Third;
- }
- int id = 33;
- string description = "This is a custom solution";
- DateTime created = DateTime.Now;
- KeyValuePair<int, KeyValuePair<string, DateTime>> triple =
- new KeyValuePair<int, KeyValuePair<string, DateTime>>();
- triple.Key = id;
- triple.Value.Key = description;
- triple.Value.Value = created;
- KeyValuePair<KeyValuePair<KeyValuePair<string, string>, string, string> quadruple =
- new KeyValuePair<KeyValuePair<KeyValuePair<string, string>, string, string>();
- public Tuple<int, string, int> GetSomething()
- {
- //do stuff to get your multi-value return
- }
- //then call it:
- var retVal = GetSomething();
- //problem is what does this mean?
- retVal.Item1 / retVal.Item3;
- //what are item 1 and 3?
- class CustomRetVal {
- int CurrentIndex { get; set; }
- string Message { get; set; }
- int CurrentTotal { get; set; }
- }
- var retVal = GetSomething();
- //get % progress
- retVal.CurrentIndex / retVal.CurrentTotal;
- Dictionary<KeyValuePair<string, int>, object>
- public class Triple<T, U, V>
- {
- public T First {get;set;}
- public U Second {get;set;}
- public V Third {get;set;}
- }
Add Comment
Please, Sign In to add comment