You’re going to have to provide more than just this snippet of code. What is the Time object you’re accessing via an indexer? Have you debugged this to see if Time[0]
actually has a value? My guess here would be that Time[0]
doesn’t return a value that DayOfWeek
can work with hence Substring(0,3)
is being running against either an empty string or a null
value
1
solved Substring compiles but code doesn’t work [closed]