@@ -38,16 +38,12 @@ public RangeFilter(int start, int end, int? steps, CrontabFieldKind kind)
38
38
var maxValue = Constants . MaximumDateTimeValues [ kind ] ;
39
39
40
40
if ( start < 0 || start > maxValue )
41
- throw new CrontabException ( string . Format ( "Start = {0} is out of bounds for <{1}> field" , start ,
42
- Enum . GetName ( typeof ( CrontabFieldKind ) , kind ) ) ) ;
41
+ throw new CrontabException ( $ "Start = { start } is out of bounds for <{ Enum . GetName ( typeof ( CrontabFieldKind ) , kind ) } > field") ;
43
42
44
- if ( end < 0 || end > maxValue )
45
- throw new CrontabException ( string . Format ( "End = {0} is out of bounds for <{1}> field" , end ,
46
- Enum . GetName ( typeof ( CrontabFieldKind ) , kind ) ) ) ;
43
+ if ( end < 0 || end > maxValue ) throw new CrontabException ( $ "End = { end } is out of bounds for <{ Enum . GetName ( typeof ( CrontabFieldKind ) , kind ) } > field") ;
47
44
48
45
if ( steps != null && ( steps <= 0 || steps > maxValue ) )
49
- throw new CrontabException ( string . Format ( "Steps = {0} is out of bounds for <{1}> field" , steps ,
50
- Enum . GetName ( typeof ( CrontabFieldKind ) , kind ) ) ) ;
46
+ throw new CrontabException ( $ "Steps = { steps } is out of bounds for <{ Enum . GetName ( typeof ( CrontabFieldKind ) , kind ) } > field") ;
51
47
52
48
Start = start ;
53
49
End = end ;
@@ -144,18 +140,14 @@ public int First()
144
140
145
141
while ( newValue < max && ! _IsMatch ( newValue ) ) newValue ++ ;
146
142
147
- if ( newValue > max )
148
- throw new CrontabException ( string . Format ( "Next value for {0} on field {1} could not be found!" ,
149
- ToString ( ) ,
150
- Enum . GetName ( typeof ( CrontabFieldKind ) , Kind ) )
151
- ) ;
143
+ if ( newValue > max ) throw new CrontabException ( $ "Next value for { ToString ( ) } on field { Enum . GetName ( typeof ( CrontabFieldKind ) , Kind ) } could not be found!") ;
152
144
153
145
_firstCache = newValue ;
154
146
return newValue ;
155
147
}
156
148
157
149
private bool _IsMatch ( int evalValue ) { return evalValue >= Start && evalValue <= End && ( ! Steps . HasValue || ( evalValue - Start ) % Steps == 0 ) ; }
158
150
159
- public override string ToString ( ) { return Steps . HasValue ? string . Format ( "{0}-{1}/{2}" , Start , End , Steps ) : string . Format ( "{0 }-{1}" , Start , End ) ; }
151
+ public override string ToString ( ) { return Steps . HasValue ? string . Format ( "{0}-{1}/{2}" , Start , End , Steps ) : $ " { Start } -{ End } " ; }
160
152
}
161
153
}
0 commit comments