[NUI] Fix a build warning CA1827 (#2314)
authorSeoyeon2Kim <34738918+Seoyeon2Kim@users.noreply.github.com>
Thu, 3 Dec 2020 05:49:53 +0000 (14:49 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Tue, 8 Dec 2020 06:23:12 +0000 (15:23 +0900)
- Changed to use `Count()` method once for a local variable.
 Then, we do not have to be worried about CA1827.
- To fix the build warning, it could replace `Count()` method with `Any()` method
 https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1827
- But, to improve performance as a review, use `Count()` itself.

Signed-off-by: Seoyeon Kim <seoyeon2.kim@samsung.com>
src/Tizen.NUI/src/public/BaseComponents/ControlState.cs

index 205b88d..352ee06 100755 (executable)
@@ -285,13 +285,14 @@ namespace Tizen.NUI.BaseComponents
             }
 
             var rest = lhs.stateList.Except(rhs.stateList);
+            var count = rest.Count();
 
-            if (rest.Count() == 0)
+            if (count == 0)
             {
                 return Normal;
             }
 
-            if (rest.Count() == 1)
+            if (count == 1)
             {
                 return rest.First();
             }