This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
namespace Action_vs_Func_vs_Predicate | |
{ | |
class Program | |
{ | |
public delegate void PrintDelegate(int val); | |
public delegate void MyDelegate(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int numAllow = 3; | |
var str = new String('o', numAllow); | |
var innerPattern = new String('o', numAllow + 1); | |
var pattern = $"{innerPattern}+"; | |
var strToChange = "AAAooooooooAAAooooAAAAAAoooAAAAAooAAAAooooooooooooooooooooooooAAAAA"; | |
var output = Regex.Replace(strToChange, pattern, str); | |
Console.WriteLine(output); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//List<int> indexes = "fooStringfooBar".AllIndexesOf("foo"); | |
//List<int> indexes2 = "fooStringfoofooBar".AllIndexesOf("foo"); | |
//List<int> indexes3 = "oooStringoooBar".AllIndexesOf("ooo"); | |
//List<int> indexes4 = "oooStringooooooBar".AllIndexesOf("ooo"); | |
//List<int> indexes5 = "ooooStringooooooBar".AllIndexesOf("ooo"); | |
public static List<int> AllIndexesOf(this string str,char c, int allowedNum) | |
{ | |
var value = new String(c, allowedNum); | |
if (String.IsNullOrEmpty(value)) | |
throw new ArgumentException("the string to find may not be empty", "value"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static IEnumerable<int> FindAll(this string str, string sub) | |
{ | |
if (sub.Length < 1) | |
yield break; | |
var index = 0; | |
while (true) | |
{ | |
index = str.IndexOf(sub, index + 1, StringComparison.InvariantCultureIgnoreCase); | |
if (index == -1) | |
break; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Restoring packages for C:\Users\eryondon\Downloads\nuget-sample-master\nuget-sample-master\A\Dtwt\Dtwt.csproj... | |
Restoring packages for C:\Users\eryondon\Downloads\nuget-sample-master\nuget-sample-master\A\Dtw\Dtw.csproj... | |
Restoring packages for C:\Users\eryondon\Downloads\nuget-sample-master\nuget-sample-master\A\Dtp\Dtp.csproj... | |
Restoring packages for C:\Users\eryondon\Downloads\nuget-sample-master\nuget-sample-master\I\Imc\Imc.csproj... | |
Restoring packages for C:\Users\eryondon\Downloads\nuget-sample-master\nuget-sample-master\I\Ic\Ic.csproj... | |
Restoring packages for C:\Users\eryondon\Downloads\nuget-sample-master\nuget-sample-master\Cc\Fs\Fs.csproj... | |
Restoring packages for C:\Users\eryondon\Downloads\nuget-sample-master\nuget-sample-master\Cc\McC\McC.csproj... | |
Restoring packages for C:\Users\eryondon\Downloads\nuget-sample-master\nuget-sample-master\Cc\ApP\ApP.csproj... | |
Restoring packages for C:\Users\eryondon\Downloads\nuget-sample-master\nuget-sample-master\Cc\McPs\McPs.csproj... | |
Restoring packages fo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Restoring packages for C:\Users\eryondon\Downloads\nuget-sample-master\nuget-sample-master\A\Dtwt\Dtwt.csproj... | |
NU1605: Detected package downgrade: Newtonsoft.Json from 9.0.1 to 8.0.3. Reference the package directly from the project to select a different version. | |
Dtwt -> Dtw -> Newtonsoft.Json (>= 9.0.1) | |
Dtwt -> Newtonsoft.Json (>= 8.0.3) | |
Restoring packages for C:\Users\eryondon\Downloads\nuget-sample-master\nuget-sample-master\A\Dtw\Dtw.csproj... | |
NU1605: Detected package downgrade: Newtonsoft.Json from 9.0.1 to 8.0.3. Reference the package directly from the project to select a different version. | |
Dtw -> Dc -> Newtonsoft.Json (>= 9.0.1) | |
Dtw -> Newtonsoft.Json (>= 8.0.3) | |
NU1605: Detected package downgrade: Newtonsoft.Json from 9.0.1 to 8.0.3. Reference the package directly from the project to select a different version. | |
Dtw -> Sdc -> Newtonsoft.Json (>= 9.0.1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Restoring packages for C:\Users\eryondon\Downloads\nuget-sample-master\nuget-sample-master\Cc\AdmT\AdmT.csproj... | |
Restoring packages for C:\Users\eryondon\Downloads\nuget-sample-master\nuget-sample-master\Cc\Fs\Fs.csproj... | |
Restoring packages for C:\Users\eryondon\Downloads\nuget-sample-master\nuget-sample-master\S\D\Sddnac\Sddnac.csproj... | |
Restoring packages for C:\Users\eryondon\Downloads\nuget-sample-master\nuget-sample-master\Cc\McC\McC.csproj... | |
Restoring packages for C:\Users\eryondon\Downloads\nuget-sample-master\nuget-sample-master\Cc\McPs\McPs.csproj... | |
Restoring packages for C:\Users\eryondon\Downloads\nuget-sample-master\nuget-sample-master\Cc\ApT\ApT.csproj... | |
Restoring packages for C:\Users\eryondon\Downloads\nuget-sample-master\nuget-sample-master\A\Dtw\Dtw.csproj... | |
Restoring packages for C:\Users\eryondon\Downloads\nuget-sample-master\nuget-sample-master\S\D\Sdft\Sdft.csproj... | |
GET https://api.nuget.org/v3-flatcontainer/newtonsoft.json/index.json | |
OK https://api.nuget.org/v3-flatcontainer/n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Restoring packages for C:\Users\eryondon\Downloads\nuget-sample-master\nuget-sample-master\C\Dcwt\Dcwt.csproj... | |
Restoring packages for C:\Users\eryondon\Downloads\nuget-sample-master\nuget-sample-master\C\Dc\Dc.csproj... | |
Restoring packages for C:\Users\eryondon\Downloads\nuget-sample-master\nuget-sample-master\C\Dct\Dct.csproj... | |
Restoring packages for C:\Users\eryondon\Downloads\nuget-sample-master\nuget-sample-master\S\D\Sdc\Sdc.csproj... | |
Restoring packages for C:\Users\eryondon\Downloads\nuget-sample-master\nuget-sample-master\S\D\Sddnac\Sddnac.csproj... | |
Restoring packages for C:\Users\eryondon\Downloads\nuget-sample-master\nuget-sample-master\S\D\Sdct\Sdct.csproj... | |
Restoring packages for C:\Users\eryondon\Downloads\nuget-sample-master\nuget-sample-master\A\Dtwt\Dtwt.csproj... | |
Restoring packages for C:\Users\eryondon\Downloads\nuget-sample-master\nuget-sample-master\A\Dtp\Dtp.csproj... | |
Restoring packages for C:\Users\eryondon\Downloads\nuget-sample-master\nuget-sample-master\Cc\ApT\ApT.csproj... | |
Restorin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Restoring packages for C:\Users\eryondon\Downloads\MainApplication.Xplat\MainApplication.Xplat\ConsoleApp1\ConsoleApp1.csproj... | |
Restoring packages for C:\Users\eryondon\Downloads\MainApplication.Xplat\MainApplication.Xplat\MainApplication.Xplat\MainApplication.Xplat.csproj... | |
Restoring packages for C:\Users\eryondon\Downloads\MainApplication.Xplat\MainApplication.Xplat\ConsoleApp2\ConsoleApp2.csproj... | |
Installing NuGet package Newtonsoft.Json 12.0.3. | |
Installing NuGet package NuGet.Protocol 5.7.0-rtm.6702. | |
Committing restore... | |
Writing assets file to disk. Path: C:\Users\eryondon\Downloads\MainApplication.Xplat\MainApplication.Xplat\MainApplication.Xplat\obj\project.assets.json | |
Successfully uninstalled 'Microsoft.Win32.Primitives 4.0.1' from MainApplication.Xplat | |
Successfully uninstalled 'Microsoft.Win32.Registry 4.0.0' from MainApplication.Xplat | |
Successfully uninstalled 'NETStandard.Library 1.6.0' from MainApplication.Xplat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Restoring packages for C:\Users\eryondon\Downloads\MainApplication.Xplat\MainApplication.Xplat\ConsoleApp2\ConsoleApp2.csproj... | |
Restoring packages for C:\Users\eryondon\Downloads\MainApplication.Xplat\MainApplication.Xplat\ConsoleApp1\ConsoleApp1.csproj... | |
Restoring packages for C:\Users\eryondon\Downloads\MainApplication.Xplat\MainApplication.Xplat\MainApplication.Xplat\MainApplication.Xplat.csproj... | |
Installing NuGet package Newtonsoft.Json 12.0.3. | |
Installing NuGet package NuGet.Protocol 5.7.0-rtm.6702. | |
Committing restore... | |
Generating MSBuild file C:\Users\eryondon\Downloads\MainApplication.Xplat\MainApplication.Xplat\MainApplication.Xplat\obj\MainApplication.Xplat.csproj.nuget.g.props. | |
Writing assets file to disk. Path: C:\Users\eryondon\Downloads\MainApplication.Xplat\MainApplication.Xplat\MainApplication.Xplat\obj\project.assets.json | |
Successfully uninstalled 'Microsoft.CSharp 4.0.1' from MainApplication.Xplat | |
Successfully uninstalled 'Newtonsoft.Json 9.0.1' from MainApplication.Xplat |
OlderNewer