diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md
new file mode 100644
index 00000000..52d61549
--- /dev/null
+++ b/.github/copilot-instructions.md
@@ -0,0 +1,15 @@
+ .
+ .
+ , , .
+ ( ) , .
+ .
+ .
+ .
+ .
+ snake_case.
+ PascalCase.
+ _PascalCase __PascalCase .
+ , , .
+ , .
+ var.
+ , .
\ No newline at end of file
diff --git a/MathCore.sln b/MathCore.sln
index a9798ea6..d8c30065 100644
--- a/MathCore.sln
+++ b/MathCore.sln
@@ -16,7 +16,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".Service", ".Service", "{B1
BuildAndPublish.bat = BuildAndPublish.bat
BuildAndTest.bat = BuildAndTest.bat
BuildRelease.bat = BuildRelease.bat
+ .github\copilot-instructions.md = .github\copilot-instructions.md
Directory.Build.props = Directory.Build.props
+ .github\workflows\publish.yml = .github\workflows\publish.yml
+ .github\workflows\testing.yml = .github\workflows\testing.yml
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Benchmarks", "Tests\Benchmarks\Benchmarks.csproj", "{80108823-1EA4-46AC-B365-8B0F9CE59CC6}"
@@ -25,6 +28,17 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MathCore.Algorithms", "Test
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MathCore.Tests.WPF", "Tests\MathCore.Tests.WPF\MathCore.Tests.WPF.csproj", "{2DDA14D6-76EE-4D0A-B9DE-638778395934}"
EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{386742AE-F590-4AA4-8395-53877DC1799F}"
+ ProjectSection(SolutionItems) = preProject
+ .github\copilot-instructions.md = .github\copilot-instructions.md
+ EndProjectSection
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{DC32AE4E-B09F-4746-BDC2-2168F61E5454}"
+ ProjectSection(SolutionItems) = preProject
+ .github\workflows\publish.yml = .github\workflows\publish.yml
+ .github\workflows\testing.yml = .github\workflows\testing.yml
+ EndProjectSection
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -33,14 +47,6 @@ Global
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {2DDA14D6-76EE-4D0A-B9DE-638778395934}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {2DDA14D6-76EE-4D0A-B9DE-638778395934}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {2DDA14D6-76EE-4D0A-B9DE-638778395934}.Debug|x64.ActiveCfg = Debug|Any CPU
- {2DDA14D6-76EE-4D0A-B9DE-638778395934}.Debug|x64.Build.0 = Debug|Any CPU
- {2DDA14D6-76EE-4D0A-B9DE-638778395934}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {2DDA14D6-76EE-4D0A-B9DE-638778395934}.Release|Any CPU.Build.0 = Release|Any CPU
- {2DDA14D6-76EE-4D0A-B9DE-638778395934}.Release|x64.ActiveCfg = Release|Any CPU
- {2DDA14D6-76EE-4D0A-B9DE-638778395934}.Release|x64.Build.0 = Release|Any CPU
{AFA60C84-107F-4582-8EED-2273957E89C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AFA60C84-107F-4582-8EED-2273957E89C5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AFA60C84-107F-4582-8EED-2273957E89C5}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -81,16 +87,26 @@ Global
{2B8FF1EE-42E8-4961-A734-1068F008D7D1}.Release|Any CPU.Build.0 = Release|Any CPU
{2B8FF1EE-42E8-4961-A734-1068F008D7D1}.Release|x64.ActiveCfg = Release|Any CPU
{2B8FF1EE-42E8-4961-A734-1068F008D7D1}.Release|x64.Build.0 = Release|Any CPU
+ {2DDA14D6-76EE-4D0A-B9DE-638778395934}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {2DDA14D6-76EE-4D0A-B9DE-638778395934}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {2DDA14D6-76EE-4D0A-B9DE-638778395934}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {2DDA14D6-76EE-4D0A-B9DE-638778395934}.Debug|x64.Build.0 = Debug|Any CPU
+ {2DDA14D6-76EE-4D0A-B9DE-638778395934}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {2DDA14D6-76EE-4D0A-B9DE-638778395934}.Release|Any CPU.Build.0 = Release|Any CPU
+ {2DDA14D6-76EE-4D0A-B9DE-638778395934}.Release|x64.ActiveCfg = Release|Any CPU
+ {2DDA14D6-76EE-4D0A-B9DE-638778395934}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{25AFB0DF-BCC9-45CA-AA0D-CB76AC5F906D} = {3B53E842-750F-4865-97C0-1703CDDE4C9F}
- {2DDA14D6-76EE-4D0A-B9DE-638778395934} = {3B53E842-750F-4865-97C0-1703CDDE4C9F}
{744E4BA2-2EA7-4AD5-B732-47230ED0A3F1} = {3B53E842-750F-4865-97C0-1703CDDE4C9F}
{80108823-1EA4-46AC-B365-8B0F9CE59CC6} = {3B53E842-750F-4865-97C0-1703CDDE4C9F}
{2B8FF1EE-42E8-4961-A734-1068F008D7D1} = {3B53E842-750F-4865-97C0-1703CDDE4C9F}
+ {2DDA14D6-76EE-4D0A-B9DE-638778395934} = {3B53E842-750F-4865-97C0-1703CDDE4C9F}
+ {386742AE-F590-4AA4-8395-53877DC1799F} = {B1568FA3-D7EB-4AC6-8208-7F6095E14ED6}
+ {DC32AE4E-B09F-4746-BDC2-2168F61E5454} = {386742AE-F590-4AA4-8395-53877DC1799F}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {5C46D916-D8DA-4B92-A70C-6EE0C6B01CAD}
diff --git a/MathCore.sln.DotSettings b/MathCore.sln.DotSettings
index 6286a5c9..f1f56644 100644
--- a/MathCore.sln.DotSettings
+++ b/MathCore.sln.DotSettings
@@ -22,6 +22,7 @@
LN
LSB
LU
+ LUP
MNK
MSB
NOD
diff --git a/MathCore/CSV/CSVQuery.cs b/MathCore/CSV/CSVQuery.cs
index 1a75bdd1..1a7a677c 100644
--- a/MathCore/CSV/CSVQuery.cs
+++ b/MathCore/CSV/CSVQuery.cs
@@ -141,7 +141,7 @@ private static IDictionary Merge(IDictionary? Source,
/// Добавить колонки в считываемый заголовок
/// Новые псевдонимы колонок
/// Модифицированных новый экземпляр
- public CSVQuery AddColumns(params (string AliasName, int Index)[] Columns) => MergeHeader(Columns.ToDictionary(c => c.AliasName, c => c.Index));
+ public CSVQuery AddColumns(params IEnumerable<(string AliasName, int Index)> Columns) => MergeHeader(Columns.ToDictionary(c => c.AliasName, c => c.Index));
/// Удалить колонку по указанному имени
/// Имя удаляемой колонки
diff --git a/MathCore/Collections/FList.cs b/MathCore/Collections/FList.cs
index e6a0f4e2..dbadd112 100644
--- a/MathCore/Collections/FList.cs
+++ b/MathCore/Collections/FList.cs
@@ -17,17 +17,17 @@ public static class FList
/// Возвращает новый экземпляр списка, содержащий указанный элемент
public static FList New(T item) => FList.New(item, FList.Empty);
- /// Создать новый список, содержащий указанные элементы
+ /// Создать новый список, содержащий указанное перечисление элементов
/// Тип элементов списка
- /// Элементы, добавляемые в список
- /// Возвращает новый список, содержащий указанные элементы
- public static FList New(params T[] items) => New((IEnumerable)items);
+ /// Перечисление элементов, на основе которых необходимо создать новый список
+ /// Возвращает новый список, содержащий элементы из указанного перечисления
+ public static FList New(T[] items) => FList.New(items);
/// Создать новый список, содержащий указанное перечисление элементов
/// Тип элементов списка
/// Перечисление элементов, на основе которых необходимо создать новый список
/// Возвращает новый список, содержащий элементы из указанного перечисления
- public static FList New(IEnumerable items) => FList.New(items);
+ public static FList New(params IEnumerable items) => FList.New(items);
}
/// Функциональный список
diff --git a/MathCore/CommandProcessor/CommandLineProcessor.cs b/MathCore/CommandProcessor/CommandLineProcessor.cs
index c0e8a3df..9b0a78e0 100644
--- a/MathCore/CommandProcessor/CommandLineProcessor.cs
+++ b/MathCore/CommandProcessor/CommandLineProcessor.cs
@@ -166,7 +166,7 @@ public CommandLineProcessor(
/// Обработать команду
/// Командная строка
- public IEnumerable Process(params string[] CommandLine)
+ public IEnumerable Process(params IEnumerable CommandLine)
{
var commands = CommandLine.SelectMany(str => str.Split(CommandSplitter))
.Select(s => s.ClearSystemSymbolsAtBeginAndEnd())
diff --git a/MathCore/Complex.IBinaryFloatingPointIeee754.cs b/MathCore/Complex.IBinaryFloatingPointIeee754.cs
new file mode 100644
index 00000000..e468df32
--- /dev/null
+++ b/MathCore/Complex.IBinaryFloatingPointIeee754.cs
@@ -0,0 +1,220 @@
+#if NET5_0_OR_GREATER
+
+using System.Globalization;
+using System.Numerics;
+
+namespace MathCore;
+
+public readonly partial struct Complex : IBinaryFloatingPointIeee754
+{
+ int IComparable.CompareTo(object obj) => throw new NotImplementedException();
+
+ int IComparable.CompareTo(Complex other) => throw new NotImplementedException();
+
+ static Complex IBitwiseOperators.operator &(Complex left, Complex right) => throw new NotImplementedException();
+
+ static Complex IBitwiseOperators.operator |(Complex left, Complex right) => throw new NotImplementedException();
+
+ static Complex IBitwiseOperators.operator ~(Complex value) => throw new NotImplementedException();
+
+ static bool IComparisonOperators.operator >(Complex left, Complex right) => throw new NotImplementedException();
+
+ static bool IComparisonOperators.operator >=(Complex left, Complex right) => throw new NotImplementedException();
+
+ static bool IComparisonOperators.operator <(Complex left, Complex right) => throw new NotImplementedException();
+
+ static bool IComparisonOperators.operator <=(Complex left, Complex right) => throw new NotImplementedException();
+
+ static Complex IDecrementOperators.operator --(Complex value) => throw new NotImplementedException();
+
+ static Complex IIncrementOperators.operator ++(Complex value) => throw new NotImplementedException();
+
+ static Complex IModulusOperators.operator %(Complex left, Complex right) => throw new NotImplementedException();
+
+ static Complex INumberBase.Abs(Complex value) => value.Abs;
+
+ static bool INumberBase.IsCanonical(Complex value) => throw new NotImplementedException();
+
+ static bool INumberBase.IsComplexNumber(Complex value) => true;
+
+ static bool INumberBase.IsEvenInteger(Complex value) => throw new NotImplementedException();
+
+ static bool INumberBase.IsFinite(Complex value) => throw new NotImplementedException();
+
+ static bool INumberBase.IsImaginaryNumber(Complex value) => throw new NotImplementedException();
+
+ static bool INumberBase.IsInfinity(Complex value) => throw new NotImplementedException();
+
+ static bool INumberBase.IsInteger(Complex value) => throw new NotImplementedException();
+
+ static bool INumberBase.IsNaN(Complex value) => value.IsNaN;
+
+ static bool INumberBase.IsNegative(Complex value) => throw new NotImplementedException();
+
+ static bool INumberBase.IsNegativeInfinity(Complex value) => throw new NotImplementedException();
+
+ static bool INumberBase.IsNormal(Complex value) => throw new NotImplementedException();
+
+ static bool INumberBase.IsOddInteger(Complex value) => throw new NotImplementedException();
+
+ static bool INumberBase.IsPositive(Complex value) => throw new NotImplementedException();
+
+ static bool INumberBase.IsPositiveInfinity(Complex value) => throw new NotImplementedException();
+
+ static bool INumberBase.IsRealNumber(Complex value) => value.Im == 0;
+
+ static bool INumberBase.IsSubnormal(Complex value) => throw new NotImplementedException();
+
+ static bool INumberBase.IsZero(Complex value) => value is { Re: 0, Im: 0 };
+
+ static Complex INumberBase.MaxMagnitude(Complex x, Complex y) => throw new NotImplementedException();
+
+ static Complex INumberBase.MaxMagnitudeNumber(Complex x, Complex y) => throw new NotImplementedException();
+
+ static Complex INumberBase.MinMagnitude(Complex x, Complex y) => throw new NotImplementedException();
+
+ static Complex INumberBase.MinMagnitudeNumber(Complex x, Complex y) => throw new NotImplementedException();
+
+ static Complex INumberBase.Parse(ReadOnlySpan s, NumberStyles style, IFormatProvider provider) => throw new NotImplementedException();
+
+ static Complex INumberBase.Parse(string s, NumberStyles style, IFormatProvider provider) => throw new NotImplementedException();
+
+ static bool INumberBase.TryConvertFromChecked(TOther value, out Complex result) => throw new NotImplementedException();
+
+ static bool INumberBase.TryConvertFromSaturating(TOther value, out Complex result) => throw new NotImplementedException();
+
+ static bool INumberBase.TryConvertFromTruncating(TOther value, out Complex result) => throw new NotImplementedException();
+
+ static bool INumberBase.TryConvertToChecked(Complex value, out TOther result) => throw new NotImplementedException();
+
+ static bool INumberBase.TryConvertToSaturating(Complex value, out TOther result) => throw new NotImplementedException();
+
+ static bool INumberBase.TryConvertToTruncating(Complex value, out TOther result) => throw new NotImplementedException();
+
+ static bool INumberBase.TryParse(ReadOnlySpan s, NumberStyles style, IFormatProvider provider, out Complex result) => throw new NotImplementedException();
+
+ static bool INumberBase.TryParse(string s, NumberStyles style, IFormatProvider provider, out Complex result) => throw new NotImplementedException();
+
+ static Complex INumberBase.One => Real;
+
+ static int INumberBase.Radix => throw new NotImplementedException();
+
+ static Complex INumberBase.Zero => Zero;
+
+ static bool IBinaryNumber.IsPow2(Complex value) => throw new NotImplementedException();
+
+ //static Complex ILogarithmicFunctions.Log(Complex x) => Log(x, Math.E);
+
+ static Complex ILogarithmicFunctions.Log(Complex x, Complex Base) => throw new NotImplementedException();
+
+ public static Complex Log10(Complex x) => Log(x, 10);
+
+ public static Complex Log2(Complex x) => Log(x, 2);
+
+ static Complex IFloatingPointConstants.E => throw new NotImplementedException();
+
+ static Complex IFloatingPointConstants.Pi => throw new NotImplementedException();
+
+ static Complex IFloatingPointConstants.Tau => throw new NotImplementedException();
+
+ static Complex IExponentialFunctions.Exp10(Complex x) => throw new NotImplementedException();
+
+ static Complex IExponentialFunctions.Exp2(Complex x) => throw new NotImplementedException();
+
+ static Complex ISignedNumber.NegativeOne => -Real;
+
+ int IFloatingPoint.GetExponentByteCount() => throw new NotImplementedException();
+
+ int IFloatingPoint.GetExponentShortestBitLength() => throw new NotImplementedException();
+
+ int IFloatingPoint.GetSignificandBitLength() => throw new NotImplementedException();
+
+ int IFloatingPoint.GetSignificandByteCount() => throw new NotImplementedException();
+
+ static Complex IFloatingPoint.Round(Complex x, int digits, MidpointRounding mode) => throw new NotImplementedException();
+
+ bool IFloatingPoint.TryWriteExponentBigEndian(Span destination, out int bytesWritten) => throw new NotImplementedException();
+
+ bool IFloatingPoint.TryWriteExponentLittleEndian(Span destination, out int bytesWritten) => throw new NotImplementedException();
+
+ bool IFloatingPoint.TryWriteSignificandBigEndian(Span destination, out int bytesWritten) => throw new NotImplementedException();
+
+ bool IFloatingPoint.TryWriteSignificandLittleEndian(Span destination, out int bytesWritten) => throw new NotImplementedException();
+
+ static Complex IHyperbolicFunctions.Acosh(Complex x) => throw new NotImplementedException();
+
+ static Complex IHyperbolicFunctions.Asinh(Complex x) => throw new NotImplementedException();
+
+ static Complex IHyperbolicFunctions.Atanh(Complex x) => throw new NotImplementedException();
+
+ static Complex IHyperbolicFunctions.Cosh(Complex x) => throw new NotImplementedException();
+
+ static Complex IHyperbolicFunctions.Sinh(Complex x) => throw new NotImplementedException();
+
+ static Complex IHyperbolicFunctions.Tanh(Complex x) => Trigonometry.Hyperbolic.Tgh(x);
+
+ static Complex IPowerFunctions.Pow(Complex x, Complex y) => x ^ y;
+
+ static Complex IRootFunctions.Cbrt(Complex x) => throw new NotImplementedException();
+
+ static Complex IRootFunctions.Hypot(Complex x, Complex y) => throw new NotImplementedException();
+
+ static Complex IRootFunctions.RootN(Complex x, int n) => throw new NotImplementedException();
+
+ static Complex ITrigonometricFunctions.Acos(Complex x) => throw new NotImplementedException();
+
+ static Complex ITrigonometricFunctions.AcosPi(Complex x) => throw new NotImplementedException();
+
+ static Complex ITrigonometricFunctions.Asin(Complex x) => throw new NotImplementedException();
+
+ static Complex ITrigonometricFunctions.AsinPi(Complex x) => throw new NotImplementedException();
+
+ static Complex ITrigonometricFunctions.Atan(Complex x) => throw new NotImplementedException();
+
+ static Complex ITrigonometricFunctions.AtanPi(Complex x) => throw new NotImplementedException();
+
+ static Complex ITrigonometricFunctions.Cos(Complex x) => Trigonometry.Cos(x);
+
+ static Complex ITrigonometricFunctions.CosPi(Complex x) => throw new NotImplementedException();
+
+ static Complex ITrigonometricFunctions.Sin(Complex x) => throw new NotImplementedException();
+
+ static (Complex Sin, Complex Cos) ITrigonometricFunctions.SinCos(Complex x) => Trigonometry.SinCos(x);
+
+ static (Complex SinPi, Complex CosPi) ITrigonometricFunctions.SinCosPi(Complex x) => throw new NotImplementedException();
+
+ static Complex ITrigonometricFunctions.SinPi(Complex x) => throw new NotImplementedException();
+
+ static Complex ITrigonometricFunctions.Tan(Complex x) => throw new NotImplementedException();
+
+ static Complex ITrigonometricFunctions.TanPi(Complex x) => throw new NotImplementedException();
+
+ static Complex IFloatingPointIeee754.Atan2(Complex y, Complex x) => throw new NotImplementedException();
+
+ static Complex IFloatingPointIeee754.Atan2Pi(Complex y, Complex x) => throw new NotImplementedException();
+
+ static Complex IFloatingPointIeee754.BitDecrement(Complex x) => throw new NotImplementedException();
+
+ static Complex IFloatingPointIeee754.BitIncrement(Complex x) => throw new NotImplementedException();
+
+ static Complex IFloatingPointIeee754.FusedMultiplyAdd(Complex left, Complex right, Complex addend) => throw new NotImplementedException();
+
+ static Complex IFloatingPointIeee754.Ieee754Remainder(Complex left, Complex right) => throw new NotImplementedException();
+
+ static int IFloatingPointIeee754.ILogB(Complex x) => throw new NotImplementedException();
+
+ static Complex IFloatingPointIeee754.ScaleB(Complex x, int n) => throw new NotImplementedException();
+
+ static Complex IFloatingPointIeee754.Epsilon => new(double.Epsilon, double.Epsilon);
+
+ static Complex IFloatingPointIeee754.NaN => NaN;
+
+ static Complex IFloatingPointIeee754.NegativeInfinity => throw new NotImplementedException();
+
+ static Complex IFloatingPointIeee754.NegativeZero => -Zero;
+
+ static Complex IFloatingPointIeee754.PositiveInfinity => throw new NotImplementedException();
+}
+
+
+#endif
\ No newline at end of file
diff --git a/MathCore/Complex.cs b/MathCore/Complex.cs
index da3e320f..383f6fca 100644
--- a/MathCore/Complex.cs
+++ b/MathCore/Complex.cs
@@ -262,6 +262,15 @@ public static bool TryParse(StringPtr str, IFormatProvider provider, out Complex
}
);
+ /// Логарифм комплексного числа по действительному аргументу
+ /// Комплексное число
+ /// Логарифм комплексного числа по действительному основанию
+ public static Complex Log(Complex z) => new
+ (
+ Re: 0.5 * Math.Log(z._Re * z._Re + z._Im * z._Im),
+ Im: z.Arg
+ );
+
/// Логарифм комплексного числа по действительному аргументу
/// Комплексное число
/// Действительное основание логарифма
diff --git a/MathCore/DifferentialEquations/Numerical/RungeKutta.cs b/MathCore/DifferentialEquations/Numerical/RungeKutta.cs
index b246f175..2efe0196 100644
--- a/MathCore/DifferentialEquations/Numerical/RungeKutta.cs
+++ b/MathCore/DifferentialEquations/Numerical/RungeKutta.cs
@@ -368,9 +368,9 @@ public static (double[] Y, double[] Error) Step45(
var k1 = f(t, y);
- static double[] GetY(double[] Y, IReadOnlyList YY, double dt, int M, params (double[] K, double k)[] kk)
+ static double[] GetY(double[] Y, IReadOnlyList YY, double dt, int M, params IReadOnlyList<(double[] K, double k)> kk)
{
- for (int i = 0, mm = kk.Length; i < M; i++)
+ for (int i = 0, mm = kk.Count; i < M; i++)
{
var yy = 0d;
for (var j = 0; j < mm; j++)
@@ -410,9 +410,9 @@ static double[] GetY(double[] Y, IReadOnlyList YY, double dt, int M, par
(k4, 49 / 176d),
(k5, -5103 / 18656d)));
- static double[] GetV(double[] Y, int M, params (double[] K, double k)[] kk)
+ static double[] GetV(double[] Y, int M, params IReadOnlyList<(double[] K, double k)> kk)
{
- for (int i = 0, mm = kk.Length; i < M; i++)
+ for (int i = 0, mm = kk.Count; i < M; i++)
{
var y = 0d;
for (var j = 0; j < mm; j++)
diff --git a/MathCore/DifferentialEquations/Numerical/RungeKuttaComplex.cs b/MathCore/DifferentialEquations/Numerical/RungeKuttaComplex.cs
index abb1d284..d26e5660 100644
--- a/MathCore/DifferentialEquations/Numerical/RungeKuttaComplex.cs
+++ b/MathCore/DifferentialEquations/Numerical/RungeKuttaComplex.cs
@@ -364,9 +364,9 @@ public static (Complex[] Y, Complex[] Error) Step45(
var k1 = f(t, y);
- static Complex[] GetY(Complex[] Y, IReadOnlyList YY, double dt, int M, params (Complex[] K, double k)[] kk)
+ static Complex[] GetY(Complex[] Y, IReadOnlyList YY, double dt, int M, params IReadOnlyList<(Complex[] K, double k)> kk)
{
- for (int i = 0, mm = kk.Length; i < M; i++)
+ for (int i = 0, mm = kk.Count; i < M; i++)
{
Complex yy = default;
for (var j = 0; j < mm; j++)
@@ -406,9 +406,9 @@ static Complex[] GetY(Complex[] Y, IReadOnlyList YY, double dt, int M,
(k4, 49 / 176d),
(k5, -5103 / 18656d)));
- static Complex[] GetV(Complex[] Y, int M, params (Complex[] K, double k)[] kk)
+ static Complex[] GetV(Complex[] Y, int M, params IReadOnlyList<(Complex[] K, double k)> kk)
{
- for (int i = 0, mm = kk.Length; i < M; i++)
+ for (int i = 0, mm = kk.Count; i < M; i++)
{
Complex y = default;
for (var j = 0; j < mm; j++)
diff --git a/MathCore/DifferentialEquations/Numerical/RungeKuttaMatrix.cs b/MathCore/DifferentialEquations/Numerical/RungeKuttaMatrix.cs
index 853c494a..8f845986 100644
--- a/MathCore/DifferentialEquations/Numerical/RungeKuttaMatrix.cs
+++ b/MathCore/DifferentialEquations/Numerical/RungeKuttaMatrix.cs
@@ -361,9 +361,9 @@ public static (Matrix[] Y, Matrix[] Error) Step45(
var k1 = f(t, y);
- static Matrix[] GetY(Matrix[] Y, IReadOnlyList YY, double dt, int M, params (Matrix[] K, double k)[] kk)
+ static Matrix[] GetY(Matrix[] Y, IReadOnlyList YY, double dt, int M, params IReadOnlyList<(Matrix[] K, double k)> kk)
{
- for (int i = 0, mm = kk.Length; i < M; i++)
+ for (int i = 0, mm = kk.Count; i < M; i++)
{
var yy = kk[0].K[i] * kk[0].k;
for (var j = 1; j < mm; j++)
@@ -403,9 +403,9 @@ static Matrix[] GetY(Matrix[] Y, IReadOnlyList YY, double dt, int M, par
(k4, 49 / 176d),
(k5, -5103 / 18656d)));
- static Matrix[] GetV(Matrix[] Y, int M, params (Matrix[] K, double k)[] kk)
+ static Matrix[] GetV(Matrix[] Y, int M, params IReadOnlyList<(Matrix[] K, double k)> kk)
{
- for (int i = 0, mm = kk.Length; i < M; i++)
+ for (int i = 0, mm = kk.Count; i < M; i++)
{
var y = kk[0].K[i] * kk[0].k;
for (var j = 1; j < mm; j++)
diff --git a/MathCore/DifferentialEquations/Numerical/RungeKuttaVector2.cs b/MathCore/DifferentialEquations/Numerical/RungeKuttaVector2.cs
index 652439dc..4d9c89b1 100644
--- a/MathCore/DifferentialEquations/Numerical/RungeKuttaVector2.cs
+++ b/MathCore/DifferentialEquations/Numerical/RungeKuttaVector2.cs
@@ -363,9 +363,9 @@ public static (Vector2D[] Y, Vector2D[] Error) Step45(
var k1 = f(t, y);
- static Vector2D[] GetY(Vector2D[] Y, IReadOnlyList YY, double dt, int M, params (Vector2D[] K, double k)[] kk)
+ static Vector2D[] GetY(Vector2D[] Y, IReadOnlyList YY, double dt, int M, params IReadOnlyList<(Vector2D[] K, double k)> kk)
{
- for (int i = 0, mm = kk.Length; i < M; i++)
+ for (int i = 0, mm = kk.Count; i < M; i++)
{
Vector2D yy = default;
for (var j = 0; j < mm; j++)
@@ -405,9 +405,9 @@ static Vector2D[] GetY(Vector2D[] Y, IReadOnlyList YY, double dt, int
(k4, 49 / 176d),
(k5, -5103 / 18656d)));
- static Vector2D[] GetV(Vector2D[] Y, int M, params (Vector2D[] K, double k)[] kk)
+ static Vector2D[] GetV(Vector2D[] Y, int M, params IReadOnlyList<(Vector2D[] K, double k)> kk)
{
- for (int i = 0, mm = kk.Length; i < M; i++)
+ for (int i = 0, mm = kk.Count; i < M; i++)
{
Vector2D y = default;
for (var j = 0; j < mm; j++)
diff --git a/MathCore/DifferentialEquations/Numerical/RungeKuttaVector3.cs b/MathCore/DifferentialEquations/Numerical/RungeKuttaVector3.cs
index 99a4c7db..e57b8b80 100644
--- a/MathCore/DifferentialEquations/Numerical/RungeKuttaVector3.cs
+++ b/MathCore/DifferentialEquations/Numerical/RungeKuttaVector3.cs
@@ -363,9 +363,9 @@ public static (Vector3D[] Y, Vector3D[] Error) Step45(
var k1 = f(t, y);
- static Vector3D[] GetY(Vector3D[] Y, IReadOnlyList YY, double dt, int M, params (Vector3D[] K, double k)[] kk)
+ static Vector3D[] GetY(Vector3D[] Y, IReadOnlyList YY, double dt, int M, params IReadOnlyList<(Vector3D[] K, double k)> kk)
{
- for (int i = 0, mm = kk.Length; i < M; i++)
+ for (int i = 0, mm = kk.Count; i < M; i++)
{
Vector3D yy = default;
for (var j = 0; j < mm; j++)
@@ -405,9 +405,9 @@ static Vector3D[] GetY(Vector3D[] Y, IReadOnlyList YY, double dt, int
(k4, 49 / 176d),
(k5, -5103 / 18656d)));
- static Vector3D[] GetV(Vector3D[] Y, int M, params (Vector3D[] K, double k)[] kk)
+ static Vector3D[] GetV(Vector3D[] Y, int M, params IReadOnlyList<(Vector3D[] K, double k)> kk)
{
- for (int i = 0, mm = kk.Length; i < M; i++)
+ for (int i = 0, mm = kk.Count; i < M; i++)
{
Vector3D y = default;
for (var j = 0; j < mm; j++)
diff --git a/MathCore/Expressions/Complex/ComplexExpression.cs b/MathCore/Expressions/Complex/ComplexExpression.cs
index 2ce1eece..bcad373e 100644
--- a/MathCore/Expressions/Complex/ComplexExpression.cs
+++ b/MathCore/Expressions/Complex/ComplexExpression.cs
@@ -113,7 +113,7 @@ public abstract class ComplexExpression
[NotNull] protected abstract Expression GetIm();
[NotNull, PublicAPI]
- public Expression Lambda(params ParameterExpression[] Parameters)
+ public Expression Lambda(params IEnumerable Parameters)
{
var t_complex = typeof(MathCore.Complex);
var constructor = t_complex.GetConstructor([typeof(double), typeof(double)]);
diff --git a/MathCore/Extensions/ArrayExtensions.cs b/MathCore/Extensions/ArrayExtensions.cs
index 55851a45..6981a1cb 100644
--- a/MathCore/Extensions/ArrayExtensions.cs
+++ b/MathCore/Extensions/ArrayExtensions.cs
@@ -2031,7 +2031,7 @@ public static T[] MixRef(this T[] array)
/// Перечень устанавливаемых значений
/// Тип элементов массива
[DST]
- public static void SetSubArrays(this T[] A, params T[][] B)
+ public static void SetSubArrays(this T[] A, params IEnumerable B)
{
var index = 0;
foreach (var array in B)
diff --git a/MathCore/Extensions/Delegates/DelegateExtensions.cs b/MathCore/Extensions/Delegates/DelegateExtensions.cs
index ec088e15..2903e6b9 100644
--- a/MathCore/Extensions/Delegates/DelegateExtensions.cs
+++ b/MathCore/Extensions/Delegates/DelegateExtensions.cs
@@ -16,16 +16,13 @@ public static class DelegateExtensions
#region Expressions
public static MCEx GetCallExpression(this Delegate d, Ex arg) => d.Method.GetCallExpression(arg);
- public static MCEx GetCallExpression(this Delegate d, IEnumerable arg) => d.Method.GetCallExpression(arg);
- public static MCEx GetCallExpression(this Delegate d, params Ex[] arg) => d.Method.GetCallExpression(arg);
+ public static MCEx GetCallExpression(this Delegate d, params IEnumerable arg) => d.Method.GetCallExpression(arg);
public static MCEx GetCallExpression(this MethodInfo d, Ex arg) => Ex.Call(d, arg);
- public static MCEx GetCallExpression(this MethodInfo d, IEnumerable arg) => Ex.Call(d, arg);
- public static MCEx GetCallExpression(this MethodInfo d, params Ex[] arg) => Ex.Call(d, arg);
- public static MCEx GetCallExpression(this MethodInfo d, Ex instance, params Ex[] arg) => Ex.Call(instance, d, arg);
+ public static MCEx GetCallExpression(this MethodInfo d, params IEnumerable arg) => Ex.Call(d, arg);
+ public static MCEx GetCallExpression(this MethodInfo d, Ex instance, params IEnumerable arg) => Ex.Call(instance, d, arg);
- public static InvocationExpression GetInvokeExpression(this Delegate d, IEnumerable arg) => d.ToExpression().GetInvoke(arg);
- public static InvocationExpression GetInvokeExpression(this Delegate d, params Ex[] arg) => d.ToExpression().GetInvoke(arg);
+ public static InvocationExpression GetInvokeExpression(this Delegate d, params IEnumerable arg) => d.ToExpression().GetInvoke(arg);
#endregion
diff --git a/MathCore/Extensions/Expressions/ExpressionExtensions.cs b/MathCore/Extensions/Expressions/ExpressionExtensions.cs
index 3de643fd..ff8c400e 100644
--- a/MathCore/Extensions/Expressions/ExpressionExtensions.cs
+++ b/MathCore/Extensions/Expressions/ExpressionExtensions.cs
@@ -234,14 +234,14 @@ public static bEx AddWithConversion(this Ex left, Ex right) =>
public static bEx Add(this Ex left, string right) => left.Add(right.ToExpression());
public static bEx Add(this Ex left, T right) => Ex.Add(left, right as Ex ?? right.ToExpression());
- public static bEx? Add(this Ex? left, params T[]? right)
+ public static bEx? Add(this Ex? left, params IReadOnlyList? right)
{
var i = 0;
Ex l;
if (left != null) l = left;
- else if (right is null || right.Length == i) return null;
+ else if (right is null || right.Count == i) return null;
else l = right[i++].ToExpression();
- while (i < right?.Length)
+ while (i < right?.Count)
l = l.AddWithConversion(right[i++].ToExpression());
return (bEx)l;
}
@@ -274,28 +274,28 @@ public static bEx MultiplyWithConversion(this Ex left, Ex right) =>
public static bEx Multiply(this Ex left, int right) => left.MultiplyWithConversion(right.ToExpression());
public static bEx Multiply(this Ex left, double right) => left.MultiplyWithConversion(right.ToExpression());
- public static bEx? Multiply(this Ex? left, params Ex[]? right)
+ public static bEx? Multiply(this Ex? left, params IReadOnlyList? right)
{
Ex l;
if (left != null) l = left;
- else if (right is not { Length: > 0 }) return null;
+ else if (right is not { Count: > 0 }) return null;
else l = right[1];
var i = 1;
- while (i < right?.Length)
+ while (i < right?.Count)
l = l.MultiplyWithConversion(right[i++]);
return (bEx)l;
}
- public static bEx? Multiply(this Ex? left, params T[]? right)
+ public static bEx? Multiply(this Ex? left, params IReadOnlyList? right)
{
Ex l;
if (left != null) l = left;
- else if (right is not { Length: > 0 }) return null;
+ else if (right is not { Count: > 0 }) return null;
else l = right[1] as Ex ?? right[1].ToExpression();
var i = 1;
- while (i < right?.Length)
+ while (i < right?.Count)
{
var v = right[i++];
l = l.MultiplyWithConversion(v as Ex ?? v.ToExpression());
@@ -388,31 +388,31 @@ public static bEx PowerOfWithConversion(this Ex left, Ex right)
public static bEx Coalesce(this Ex first, Ex second) => Ex.Coalesce(first, second);
public static bEx Coalesce(this Ex first, T second) => Ex.Coalesce(first, second as Ex ?? second.ToExpression());
- public static bEx? Coalesce(this Ex? left, params Ex[]? right)
+ public static bEx? Coalesce(this Ex? left, params IReadOnlyList? right)
{
var i = 0;
Ex l;
if (left != null) l = left;
- else if (right is null || right.Length == i) return null;
+ else if (right is null || right.Count == i) return null;
else l = right[i++];
- while (i < right?.Length)
+ while (i < right?.Count)
l = l.Coalesce(right[i++]);
return (bEx)l;
}
- public static bEx? Coalesce(this Ex? left, params T[]? right)
+ public static bEx? Coalesce(this Ex? left, params IReadOnlyList? right)
{
var i = 0;
Ex l;
if (left != null) l = left;
- else if (right is null || right.Length == i) return null;
+ else if (right is null || right.Count == i) return null;
else
{
var v = right[i++];
l = v as Ex ?? v.ToExpression();
}
- while (i < right?.Length) l = l.Coalesce(right[i++]);
+ while (i < right?.Count) l = l.Coalesce(right[i++]);
return (bEx)l;
}
@@ -423,28 +423,28 @@ public static bEx PowerOfWithConversion(this Ex left, Ex right)
public static bEx XOR(this Ex left, Ex right) => ExclusiveOr(left, right);
public static bEx XOR(this Ex left, T right) => ExclusiveOr(left, right as Ex ?? right.ToExpression());
- public static bEx? XOR(this Ex? left, params Ex[]? right)
+ public static bEx? XOR(this Ex? left, params IReadOnlyList? right)
{
if (left is null) return null;
- if (right is not { Length: > 0 }) return null;
+ if (right is not { Count: > 0 }) return null;
var i = 0;
var l = left;
- while (i < right.Length)
+ while (i < right.Count)
l = l.XOR(right[i++]);
return (bEx)l;
}
- public static bEx? XOR(this Ex? left, params T[]? right)
+ public static bEx? XOR(this Ex? left, params IReadOnlyList? right)
{
if (left is null) return null;
- if (right is not { Length: > 0 }) return null;
+ if (right is not { Count: > 0 }) return null;
var i = 0;
var l = left;
- while (i < right.Length)
+ while (i < right.Count)
l = l.XOR(right[i++]);
return (bEx)l;
@@ -479,8 +479,10 @@ public static bEx PowerOfWithConversion(this Ex left, Ex right)
public static Ex ToNewExpression(this Type type) => New(type.GetConstructor(Type.EmptyTypes) ?? throw new InvalidOperationException());
- public static Ex ToNewExpression(this Type type, params Ex[] p) => New(type.GetConstructor(p.Select(pp => pp.Type).ToArray()) ?? throw new InvalidOperationException("Конструктор не найден"));
- public static Ex ToNewExpression(this Type type, params T[] p) =>
+ public static Ex ToNewExpression(this Type type, params IEnumerable p) =>
+ New(type.GetConstructor(p.Select(pp => pp.Type).ToArray()) ?? throw new InvalidOperationException("Конструктор не найден"));
+
+ public static Ex ToNewExpression(this Type type, params IEnumerable p) =>
New(type.GetConstructor(p.Select(pp => pp!.GetType()).ToArray())
?? throw new InvalidOperationException("Конструктор не найден"));
@@ -493,9 +495,7 @@ public static mcEx GetCall(this Ex obj, string method, IEnumerable arg)
public static mcEx GetCall(this Ex obj, string method, params Ex[] arg)
=> Call(obj, method, arg.Select(a => a.Type).ToArray(), arg);
- public static mcEx GetCall(this Ex obj, MethodInfo method, IEnumerable arg) => Call(obj, method, arg);
-
- public static mcEx GetCall(this Ex obj, MethodInfo method, params Ex[] arg) => Call(obj, method, arg);
+ public static mcEx GetCall(this Ex obj, MethodInfo method, params IEnumerable arg) => Call(obj, method, arg);
public static mcEx GetCall(this Ex obj, MethodInfo method) => Call(obj, method);
@@ -505,17 +505,11 @@ public static mcEx GetCall(this Ex obj, string method, params Ex[] arg)
public static mcEx GetCall(this Ex obj, Delegate d) => obj.GetCall(d.Method);
- public static InvocationExpression GetInvoke(this Ex d, IEnumerable arg) => Invoke(d, arg);
-
- public static InvocationExpression GetInvoke(this Ex d, params Ex[] arg) => Invoke(d, arg);
-
- public static iEx ArrayAccess(this Ex d, IEnumerable arg) => Ex.ArrayAccess(d, arg);
-
- public static iEx ArrayAccess(this Ex d, params Ex[] arg) => Ex.ArrayAccess(d, arg);
+ public static InvocationExpression GetInvoke(this Ex d, params IEnumerable arg) => Invoke(d, arg);
- public static mcEx ArrayIndex(this Ex d, IEnumerable arg) => Ex.ArrayIndex(d, arg);
+ public static iEx ArrayAccess(this Ex d, params IEnumerable arg) => Ex.ArrayAccess(d, arg);
- public static mcEx ArrayIndex(this Ex d, params Ex[] arg) => Ex.ArrayIndex(d, arg);
+ public static mcEx ArrayIndex(this Ex d, params IEnumerable arg) => Ex.ArrayIndex(d, arg);
public static uEx ArrayLength(this Ex d) => Ex.ArrayLength(d);
public static uEx ConvertTo(this Ex d, Type type) => Convert(d, type);
@@ -543,11 +537,11 @@ public static mcEx GetCall(this Ex obj, string method, params Ex[] arg)
public static uEx MakeUnary(this Ex d, ExpressionType UType, Type type) => Ex.MakeUnary(UType, d, type);
public static bEx MakeUnary(this Ex left, Ex right, ExpressionType UType) => MakeBinary(UType, left, right);
- public static Expression CreateLambda(this Ex body, params pEx[] p) => Lambda(body, p);
+ public static Expression CreateLambda(this Ex body, params IEnumerable p) => Lambda(body, p);
public static lEx CreateLambda(this Ex body, params pEx[] p) => Lambda(body, p);
- public static lEx CreateLambda(this Ex body, Type DelegateType, params pEx[] p) => Lambda(DelegateType, body, p);
+ public static lEx CreateLambda(this Ex body, Type DelegateType, params IEnumerable p) => Lambda(DelegateType, body, p);
- public static TDelegate CompileTo(this Ex body, params pEx[] p) => body.CreateLambda(p).Compile();
+ public static TDelegate CompileTo(this Ex body, params IEnumerable p) => body.CreateLambda(p).Compile();
public static Ex CloneExpression(this Ex expr)
{
diff --git a/MathCore/Extensions/Expressions/MathExpression.cs b/MathCore/Extensions/Expressions/MathExpression.cs
index c4c84f78..37f2c565 100644
--- a/MathCore/Extensions/Expressions/MathExpression.cs
+++ b/MathCore/Extensions/Expressions/MathExpression.cs
@@ -28,6 +28,6 @@ public static class MathExpression
public static MethodCallExpression Sqrt(Expression x) => ((Func)Math.Sqrt).GetCallExpression(x);
public static BinaryExpression SqrtPower(Expression x) => x.Power(1.ToExpression().Divide(2));
public static BinaryExpression SqrtPower(Expression x, Expression y) => x.Power(1.ToExpression().Divide(y));
- public static MethodCallExpression F(Delegate f, params Expression[] args) => f.GetCallExpression(args);
- public static MethodCallExpression F(Func f, params Expression[] args) => f.GetCallExpression(args);
+ public static MethodCallExpression F(Delegate f, params IEnumerable args) => f.GetCallExpression(args);
+ public static MethodCallExpression F(Func f, params IEnumerable args) => f.GetCallExpression(args);
}
\ No newline at end of file
diff --git a/MathCore/Extensions/IEnumerableExtensions.cs b/MathCore/Extensions/IEnumerableExtensions.cs
index e7c35b91..c1b4e885 100644
--- a/MathCore/Extensions/IEnumerableExtensions.cs
+++ b/MathCore/Extensions/IEnumerableExtensions.cs
@@ -537,40 +537,18 @@ public static double Dispersion(this IEnumerable enumerable, FuncИсходная последовательность элементов
/// Добавляемый элемент
/// Результирующая последовательность элементов, в которой добавленный элемент идёт на первом месте
- public static IEnumerable InsertBefore(this IEnumerable? enumerable, params T[]? values)
+ public static IEnumerable InsertBefore(this IEnumerable? enumerable, params IEnumerable? values)
{
if (values != null) foreach (var v in values) yield return v;
if (enumerable != null) foreach (var v in enumerable) yield return v;
}
- /// Добавить элемент в начало последовательности
- /// Тип элементов последовательности
- /// Исходная последовательность элементов
- /// Добавляемый элемент
- /// Результирующая последовательность элементов, в которой добавленный элемент идёт на первом месте
- public static IEnumerable InsertBefore(this IEnumerable? enumerable, IEnumerable? values)
- {
- if (values != null) foreach (var v in values) yield return v;
- if (enumerable != null) foreach (var v in enumerable) yield return v;
- }
-
- /// Добавить элемент в конец последовательности
- /// Тип элементов последовательности
- /// Исходная последовательность элементов
- /// Добавляемый элемент
- /// Результирующая последовательность элементов, в которой добавленный элемент идёт на последнем месте
- public static IEnumerable InsertAfter(this IEnumerable? collection, params T[]? values)
- {
- if (collection != null) foreach (var v in collection) yield return v;
- if (values != null) foreach (var v in values) yield return v;
- }
-
/// Добавить элемент в конец последовательности
/// Тип элементов последовательности
/// Исходная последовательность элементов
/// Добавляемый элемент
/// Результирующая последовательность элементов, в которой добавленный элемент идёт на последнем месте
- public static IEnumerable InsertAfter(this IEnumerable? collection, IEnumerable? values)
+ public static IEnumerable InsertAfter(this IEnumerable? collection, params IEnumerable? values)
{
if (collection != null) foreach (var v in collection) yield return v;
if (values != null) foreach (var v in values) yield return v;
diff --git a/MathCore/Extensions/IListExtensions.cs b/MathCore/Extensions/IListExtensions.cs
index 132ad50e..e36ca07e 100644
--- a/MathCore/Extensions/IListExtensions.cs
+++ b/MathCore/Extensions/IListExtensions.cs
@@ -9,6 +9,13 @@ namespace System.Collections.Generic;
/// Методы расширения для интерфейса
public static class IListExtensions
{
+ /// Создать генератор случных элементов
+ /// Тип элементов списка
+ /// Список элементов, на основе которого надо создать генератор
+ /// Датчик случайных чисел
+ /// Генератор случайного значения из элементов списка
+ public static RandomizerReadOnly GetRandomizer(this IReadOnlyList Items, Random? Random = null) => new(Items, Random);
+
/// Создать генератор случных элементов
/// Тип элементов списка
/// Список элементов, на основе которого надо создать генератор
diff --git a/MathCore/Extensions/INotifyPropertyChangedExtensions.cs b/MathCore/Extensions/INotifyPropertyChangedExtensions.cs
index 6542b63d..eaf6dc08 100644
--- a/MathCore/Extensions/INotifyPropertyChangedExtensions.cs
+++ b/MathCore/Extensions/INotifyPropertyChangedExtensions.cs
@@ -41,7 +41,7 @@ void Handler(object? s, PropertyChangedEventArgs e)
/// Объект, реализующий интерфейс
/// Обработчик события типа
/// Имена свойств
- public static void RegisterPropertyChangedHandler(this INotifyPropertyChanged obj, PropertyChangedEventHandler handler, params string[] Names)
+ public static void RegisterPropertyChangedHandler(this INotifyPropertyChanged obj, PropertyChangedEventHandler handler, params IEnumerable Names)
=> obj.PropertyChanged += (s, e) => { if (Names.Any(name => string.Equals(name, e.PropertyName))) handler(s, e); };
/// Подписка на событие изменения указанных свойств
@@ -49,7 +49,7 @@ public static void RegisterPropertyChangedHandler(this INotifyPropertyChanged ob
/// Обработчик события типа
/// Имена свойств
/// Объект , вызывающий отписку от события в случае своего уничтожения
- public static IDisposable RegisterPropertyChangedHandler_Disposable(this INotifyPropertyChanged obj, PropertyChangedEventHandler handler, params string[] Names)
+ public static IDisposable RegisterPropertyChangedHandler_Disposable(this INotifyPropertyChanged obj, PropertyChangedEventHandler handler, params IEnumerable Names)
{
obj.PropertyChanged += Handler;
return new LambdaDisposable(() => obj.PropertyChanged -= Handler);
@@ -60,31 +60,6 @@ void Handler(object? s, PropertyChangedEventArgs e)
}
}
- /// Подписка на событие изменения указанных свойств
- /// Объект, реализующий интерфейс
- /// Обработчик события типа
- /// Имена свойств
- public static void RegisterPropertyChangedHandler(this INotifyPropertyChanged obj, PropertyChangedEventHandler handler, IEnumerable Names)
- => obj.PropertyChanged += (s, e) => { if (Names.Any(name => string.Equals(name, e.PropertyName))) handler(s, e); };
-
- /// Подписка на событие изменения указанных свойств
- /// Объект, реализующий интерфейс
- /// Обработчик события типа
- /// Имена свойств
- /// Объект , вызывающий отписку от события в случае своего уничтожения
- public static IDisposable RegisterPropertyChangedHandler_Disposable(this INotifyPropertyChanged obj, PropertyChangedEventHandler handler, IEnumerable Names)
- {
- var names = Names as string[] ?? Names.ToArray();
-
- obj.PropertyChanged += Handler;
- return new LambdaDisposable(() => obj.PropertyChanged -= Handler);
-
- void Handler(object? s, PropertyChangedEventArgs e)
- {
- if (names.Any(name => string.Equals(name, e.PropertyName))) handler(s, e);
- }
- }
-
#region Связи свойств по атрибутам AffectsTheAttribute и DependencyOnAttribute
/// Аргумент события изменения зависимого свойства
diff --git a/MathCore/Extensions/IO/TextWriterExtensions.cs b/MathCore/Extensions/IO/TextWriterExtensions.cs
index 4f65d6e2..bbf67084 100644
--- a/MathCore/Extensions/IO/TextWriterExtensions.cs
+++ b/MathCore/Extensions/IO/TextWriterExtensions.cs
@@ -3,12 +3,12 @@ namespace System.IO;
public static class TextWriterExtensions
{
- public static TextWriter WriteLineValues(this TextWriter writer, char Separator, params string[] values)
+ public static TextWriter WriteLineValues(this TextWriter writer, char Separator, params IReadOnlyList values)
{
- if (values.Length == 0) return writer;
+ if (values.Count == 0) return writer;
writer.Write(values[0]);
- for(var i = 1; i < values.Length; i++)
+ for(var i = 1; i < values.Count; i++)
{
writer.Write(Separator);
writer.Write(values[i]);
@@ -18,12 +18,12 @@ public static TextWriter WriteLineValues(this TextWriter writer, char Separator,
return writer;
}
- public static async Task WriteLineValuesAsync(this TextWriter writer, char Separator, params string[] values)
+ public static async Task WriteLineValuesAsync(this TextWriter writer, char Separator, params IReadOnlyList values)
{
- if (values.Length == 0) return writer;
+ if (values.Count == 0) return writer;
await writer.WriteAsync(values[0]).ConfigureAwait(false);
- for(var i = 1; i < values.Length; i++)
+ for(var i = 1; i < values.Count; i++)
{
await writer.WriteAsync(Separator).ConfigureAwait(false);
await writer.WriteAsync(values[i]).ConfigureAwait(false);
diff --git a/MathCore/Extensions/Json/IJsonTypeInfoResolverEx.cs b/MathCore/Extensions/Json/IJsonTypeInfoResolverEx.cs
index f838efad..d80852f1 100644
--- a/MathCore/Extensions/Json/IJsonTypeInfoResolverEx.cs
+++ b/MathCore/Extensions/Json/IJsonTypeInfoResolverEx.cs
@@ -31,10 +31,10 @@ public static IJsonTypeInfoResolver WithAddedModifier(this IJsonType
public static IJsonTypeInfoResolver WithAddedModifier(
this IJsonTypeInfoResolver resolver,
Action