عبارات باقاعده و نیاز به Timeout
AppDomain.CurrentDomain.SetData("REGEX_DEFAULT_MATCH_TIMEOUT", TimeSpan.FromMicroseconds(50));
Regex.IsMatch("abc", "a", RegexOptions.None, TimeSpan.FromSeconds(5));
نگاهی به MAUI در NET 6.
With .NET 6 previews starting right around the corner, it is time to start getting excited for the new .NET Multi-platform App UI (MAUI) that was announced at BUILD 2020. This year of .NET has a lot of amazing things for client application developers. Let’s review the highlights and set your expectations for the year ahead.
ویژگی های ویژوال استدیو
کتابخانه Gijgo
This post shows how to import and export .xls or .xlsx (Excel files) in ASP.NET Core. And when thinking about dealing with excel with .NET, we always look for third-party libraries or component. And one of the most popular .net library that reads and writes Excel 2007/2010 files using the Open Office Xml format (xlsx) is EPPlus. However, at the time of writing this post, this library is not updated to support .NET Core. But there exists an unofficial version of this library EPPlus.Core which can do the job of import and export xlsx in ASP.NET Core. This works on Windows, Linux and Mac.
There's two ways to deploy a .NET Core application. There's FDD and SCD. Since TLAs (three letter acronyms) are stupid, that's Framework-dependent and Self-contained. When .NET Core is installed it ends up in C:\program files\dotnet on Windows, for example. In the "Shared" folder there's a bunch of .NET stuff that is, well, shared. There may be multiple folders, as you can see in my folder below. You can have many and multiple installs of .NET Core.
public int[] WithSpread() { int[] data = new int[10_000]; int[] results = [..data]; return results; }
public int[] WithSpread() { int[] numArray1 = new int[10000]; int index1 = 0; int[] numArray2 = new int[numArray1.Length]; int[] numArray3 = numArray1; for (int index2 = 0; index2 < numArray3.Length; ++index2) { int num = numArray3[index2]; numArray2[index1] = num; ++index1; } return numArray2; }
using BenchmarkDotNet.Attributes; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SpreadBenchmark { [MemoryDiagnoser] public class Tests { private readonly int[] _myData = new int[10_000]; [Benchmark(Baseline = true)] public int[] WithToArray() { int[] results = _myData.ToArray(); return results; } [Benchmark] public int[] WithCopyTo() { int[] results = new int[_myData.Length]; _myData.CopyTo(results, 0); return results; } [Benchmark] public int[] WithSpread() { int[] results = [.._myData]; return results; } } }
using BenchmarkDotNet.Running; using SpreadBenchmark; BenchmarkRunner.Run<Tests>();
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <TargetFramework>net8.0</TargetFramework> <ImplicitUsings>enable</ImplicitUsings> <Nullable>enable</Nullable> </PropertyGroup> <ItemGroup> <PackageReference Include="BenchmarkDotNet" Version="0.13.10" /> </ItemGroup> </Project>