Skip to content

Commit 13c9053

Browse files
committed
add int exstension
1 parent a5d9e23 commit 13c9053

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

AlgorithmsLibrary/AlgorithmsLibrary.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
<Compile Include="CommonClasses\DoublyNode.cs" />
5454
<Compile Include="CommonClasses\Exception.cs" />
5555
<Compile Include="CommonClasses\TreeNodePrinter.cs" />
56+
<Compile Include="Extensions\IntExtensions.cs" />
5657
<Compile Include="Extensions\StringBuilderExtensions.cs" />
5758
<Compile Include="LZ78Algm\LZ78Algm.cs" />
5859
<Compile Include="LZ78Algm\LZ78CodeBlock.cs" />
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
namespace AlgorithmsLibrary.IntExtensions
2+
{
3+
public static class IntExtensions
4+
{
5+
public static bool InRange(this int @this, int left, int right)
6+
{
7+
if (@this >= left && @this <= right)
8+
return true;
9+
return false;
10+
}
11+
public static bool InRange(this decimal @this, decimal left, decimal right)
12+
{
13+
if (@this >= left && @this <= right)
14+
return true;
15+
return false;
16+
}
17+
public static bool InRange(this double @this, double left, double right)
18+
{
19+
if (@this >= left && @this <= right)
20+
return true;
21+
return false;
22+
}
23+
public static bool InRange(this long @this, long left, long right)
24+
{
25+
if (@this >= left && @this <= right)
26+
return true;
27+
return false;
28+
}
29+
}
30+
}

0 commit comments

Comments
 (0)