Enumerate Class Properties in C#
Posted
by user275561
on Stack Overflow
See other posts from Stack Overflow
or by user275561
Published on 2010-03-26T01:02:55Z
Indexed on
2010/03/26
1:13 UTC
Read the original article
Hit count: 318
I have a class Similar to this
public class Model
{
public TimeSpan Time1 {get; set;}
public TimeSpan Time2 { get; set; }
public TimeSpan Time3 { get; set; }
public TimeSpan Time4 { get; set; }
}
Now Let's Imagine I have to populate the times during runtime and then Figure out the time remaining between Time 1 and Time 2, then when that passes Find the time remaining between Time2 and Time3 and so on. However, I need to take into account what the time is right now.
For Example:
Now it is 1:00 PM
Time1=5:00 AM Time 2 = 12:00 PM Time 3= 4:00 PM Time 4 = 6:00 PM
So since the time is 1:00PM, I need to find the difference between Time 2 and Time 3
Now is there a smarter way other than reflection to determine this? Should i add something in my class
© Stack Overflow or respective owner