Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLluis Sanchez <lluis@xamarin.com>2019-07-22 10:40:41 +0300
committerGitHub <noreply@github.com>2019-07-22 10:40:41 +0300
commit6b910a66af3681856412f209c201f09a67866ad9 (patch)
tree3f3346fa59011be67fcfee13a9499fbda51e32c5 /main/src/core/MonoDevelop.Core
parent2425570fe26c2c8e74c99695bbd67101de54896a (diff)
parent87fb8941ce6e70b7e07d3fedcc5574cf108d2ed6 (diff)
Merge pull request #8244 from mono/array-extension
[Core] Add extension on Array to shadow IEnumerable.Contains
Diffstat (limited to 'main/src/core/MonoDevelop.Core')
-rw-r--r--main/src/core/MonoDevelop.Core/CoreExtensions.Array.cs33
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Core.csproj1
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs2
3 files changed, 35 insertions, 1 deletions
diff --git a/main/src/core/MonoDevelop.Core/CoreExtensions.Array.cs b/main/src/core/MonoDevelop.Core/CoreExtensions.Array.cs
new file mode 100644
index 0000000000..efa5f2155c
--- /dev/null
+++ b/main/src/core/MonoDevelop.Core/CoreExtensions.Array.cs
@@ -0,0 +1,33 @@
+//
+// CoreExtensions.Array.cs
+//
+// Author:
+// Marius Ungureanu <maungu@microsoft.com>
+//
+// Copyright (c) 2019 Microsoft Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System;
+namespace System
+{
+ public static partial class CoreExtensions
+ {
+ internal static bool Contains<T> (this T [] arr, T value) => Array.IndexOf (arr, value) != -1;
+ }
+}
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.csproj b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.csproj
index c86fd60eab..e1ec35552d 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.csproj
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.csproj
@@ -740,6 +740,7 @@
<Compile Include="CoreExtensions.IEnumerable.cs" />
<Compile Include="CoreExtensions.Memoize.cs" />
<Compile Include="CoreExtensions.EventHandlers.cs" />
+ <Compile Include="CoreExtensions.Array.cs" />
</ItemGroup>
<ItemGroup>
<None Include="BuildVariables.cs.in" />
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs
index c527edea1d..3df66730cc 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs
@@ -3998,7 +3998,7 @@ namespace MonoDevelop.Projects
if (p2 == null)
return false;
if (!p.ValueType.Equals (p.Value, p2.UnevaluatedValue)) {
- if (p2.UnevaluatedValue != null && p2.UnevaluatedValue.Contains ('%')) {
+ if (p2.UnevaluatedValue != null && p2.UnevaluatedValue.IndexOf ('%') != -1) {
// Check evaluated value is a match.
if (!p.ValueType.Equals (p.Value, p2.Value))
return false;