@@ -240,7 +240,7 @@ private static FlagResult<FeatureMetadataT> GetFlagResult<_, FeatureMetadataT>(E
240240 Enabled = featureContext . Enabled ,
241241 Value = variant . Value ,
242242 Metadata = featureContext . Metadata ,
243- Reason = $ "SPLIT; weight={ weight } ",
243+ Reason = FormattableString . Invariant ( $ "SPLIT; weight={ weight } ") ,
244244 } ;
245245 break ;
246246 }
@@ -336,7 +336,7 @@ private static bool LongOperations(long contextValue, Condition condition)
336336 long conditionValue ;
337337 try
338338 {
339- conditionValue = Convert . ToInt64 ( condition . Value . String ) ;
339+ conditionValue = InvariantConvert . ToInt64 ( condition . Value ) ;
340340 }
341341 catch ( FormatException )
342342 {
@@ -358,12 +358,13 @@ private static bool IntOperations(long contextValue, Condition condition)
358358 {
359359 switch ( condition . Operator )
360360 {
361- case Operator . Equal : return contextValue == Convert . ToInt32 ( condition . Value . String ) ;
362- case Operator . NotEqual : return contextValue != Convert . ToInt32 ( condition . Value . String ) ;
363- case Operator . GreaterThan : return contextValue > Convert . ToInt32 ( condition . Value . String ) ;
364- case Operator . GreaterThanInclusive : return contextValue >= Convert . ToInt32 ( condition . Value . String ) ;
365- case Operator . LessThan : return contextValue < Convert . ToInt32 ( condition . Value . String ) ;
366- case Operator . LessThanInclusive : return contextValue <= Convert . ToInt32 ( condition . Value . String ) ;
361+ case Constants . Equal : return traitValue == InvariantConvert . ToInt32 ( condition . Value ) ;
362+ case Constants . NotEqual : return traitValue != InvariantConvert . ToInt32 ( condition . Value ) ;
363+ case Constants . GreaterThan : return traitValue > InvariantConvert . ToInt32 ( condition . Value ) ;
364+ case Constants . GreaterThanInclusive : return traitValue >= InvariantConvert . ToInt32 ( condition . Value ) ;
365+ case Constants . LessThan : return traitValue < InvariantConvert . ToInt32 ( condition . Value ) ;
366+ case Constants . LessThanInclusive : return traitValue <= InvariantConvert . ToInt32 ( condition . Value ) ;
367+ case Constants . In : return condition . Value . Split ( ',' ) . Contains ( traitValue . ToString ( ) ) ;
367368 default : throw new ArgumentException ( "Invalid Operator" ) ;
368369 }
369370 }
@@ -372,12 +373,13 @@ private static bool DoubleOperations(double contextValue, Condition condition)
372373 {
373374 switch ( condition . Operator )
374375 {
375- case Operator . Equal : return contextValue == Convert . ToDouble ( condition . Value . String ) ;
376- case Operator . NotEqual : return contextValue != Convert . ToDouble ( condition . Value . String ) ;
377- case Operator . GreaterThan : return contextValue > Convert . ToDouble ( condition . Value . String ) ;
378- case Operator . GreaterThanInclusive : return contextValue >= Convert . ToDouble ( condition . Value . String ) ;
379- case Operator . LessThan : return contextValue < Convert . ToDouble ( condition . Value . String ) ;
380- case Operator . LessThanInclusive : return contextValue <= Convert . ToDouble ( condition . Value . String ) ;
376+ case Constants . Equal : return traitValue == InvariantConvert . ToDouble ( condition . Value ) ;
377+ case Constants . NotEqual : return traitValue != InvariantConvert . ToDouble ( condition . Value ) ;
378+ case Constants . GreaterThan : return traitValue > InvariantConvert . ToDouble ( condition . Value ) ;
379+ case Constants . GreaterThanInclusive : return traitValue >= InvariantConvert . ToDouble ( condition . Value ) ;
380+ case Constants . LessThan : return traitValue < InvariantConvert . ToDouble ( condition . Value ) ;
381+ case Constants . LessThanInclusive : return traitValue <= InvariantConvert . ToDouble ( condition . Value ) ;
382+ case Constants . In : return false ;
381383 default : throw new ArgumentException ( "Invalid Operator" ) ;
382384 }
383385 }
0 commit comments