MmsCore.Extensions 0.2.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package MmsCore.Extensions --version 0.2.0                
NuGet\Install-Package MmsCore.Extensions -Version 0.2.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MmsCore.Extensions" Version="0.2.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MmsCore.Extensions --version 0.2.0                
#r "nuget: MmsCore.Extensions, 0.2.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install MmsCore.Extensions as a Cake Addin
#addin nuget:?package=MmsCore.Extensions&version=0.2.0

// Install MmsCore.Extensions as a Cake Tool
#tool nuget:?package=MmsCore.Extensions&version=0.2.0                

[!IMPORTANT] This Project is not yet stable. Breaking changes may occur at any time.

MmsCore.Extensions

NuGet Version MmsCore.Extensions NuGet Package Downloads TFM TFM TFM

MmsCore.Extensionsは、DateTime、IEnumerable、ObservableCollection、stringクラスの拡張メソッドを提供します。日付操作、シーケンス操作、コレクション変換、文字列処理の操作が含まれます。

🚀 Getting Started

DateTimeExtensions

以下に DateTimeExtensions.ToNextDay の使用例を示します。

// Arrange
DateTime? today = DateTime.Today;
// Act
var tomorrow = today.ToNextDay();
// Assert
Assert.Equal(DateTime.Today.AddDays(1), tomorrow);

以下に DateTimeExtensions.ToNextMinute の使用例を示します。

// Arrange
DateTime? now = DateTime.Now;
// Act
var nextMinute = now.ToNextMinute();
// Assert
Assert.Equal(DateTime.Now.AddMinutes(1).Minute, nextMinute?.Minute);

以下に DateTimeExtensions.ToExceptedMilliseconds の使用例を示します。

// Arrange
var now = DateTime.Now;
// Act
var result = now.ToExceptedMilliseconds();
// Assert
Assert.Equal(0, result.Millisecond);

以下に DateTimeExtensions.ToExceptedSeconds の使用例を示します。

// Arrange
var now = DateTime.Now;
// Act
var result = now.ToExceptedSeconds();
// Assert
Assert.Equal(0, result.Second);
Assert.Equal(0, result.Millisecond);

EnumerableExtensions

以下に EnumerableExtensions.DistinctBy の使用例を示します。

// Arrange
List<int> source = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4];
List<int> expected = [1, 2, 3, 4];
// Act
var result = source.DistinctBy(x => x).ToList();
// Assert
Assert.Equal(expected, result);

以下に EnumerableExtensions.ForEach の使用例を示します。

// Arrange
var source = Enumerable.Range(1, 5);
var results = new List<int>();
// Act
source.ForEach(item => { results.Add(item * 2); });
// Assert
Assert.Equal([2, 4, 6, 8, 10], results);

以下に EnumerableExtensions.LeftOuterJoin の使用例を示します。

// Arrange
var outer = new List<int?> { 1, 2, 3 };
var inner = new List<int?> { 2, 3, 4 };
// Act
var result = outer.LeftOuterJoin(
    inner,
    x => x,
    y => y,
    (x, y) => new { Outer = x, Inner = y }).ToList();
// Assert
// 以下の結果が期待されます:
// { Outer = 1, Inner = null }
// { Outer = 2, Inner = 2 }
// { Outer = 3, Inner = 3 }
Assert.Equal(3, result.Count);
Assert.Equal(1, result[0].Outer);
Assert.Null(result[0].Inner);
Assert.Equal(2, result[1].Outer);
Assert.Equal(2, result[1].Inner);
Assert.Equal(3, result[2].Outer);
Assert.Equal(3, result[2].Inner);

以下に EnumerableExtensions.FullOuterJoin の使用例を示します。

// Arrange
var left = new List<int?> { 1, 2, 3 };
var right = new List<int?> { 2, 3, 4 };
// Act
var result = left.FullOuterJoin(
    right,
    x => x,
    y => y,
    (_, x, y) => new { Left = x, Right = y }).ToList();
// Assert
// 以下の結果が期待されます:
// { Left = 1, Right = null }
// { Left = 2, Right = 2 }
// { Left = 3, Right = 3 }
// { Left = null, Right = 4 }
Assert.Equal(4, result.Count);
Assert.Equal(1, result[0].Left);
Assert.Null(result[0].Right);
Assert.Equal(2, result[1].Left);
Assert.Equal(2, result[1].Right);
Assert.Equal(3, result[2].Left);
Assert.Equal(3, result[2].Right);
Assert.Null(result[3].Left);
Assert.Equal(4, result[3].Right);

以下に EnumerableExtensions.SequenceIsContiguous の使用例を示します。

// Arrange
List<int> numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
IEnumerable<int> sequence1 = [3, 4, 5];
IEnumerable<int> sequence2 = [3, 5, 6];
        
// Act
var isContiguous1 = numbers.SequenceIsContiguous(sequence1);
var isContiguous2 = numbers.SequenceIsContiguous(sequence2);
        
// Assert
Assert.True(isContiguous1);
Assert.False(isContiguous2);

以下に EnumerableExtensions.WithIndex の使用例を示します。

var data = new List<string> { "One", "Two", "Three" };
var result = data.WithIndex().ToList();
        
Assert.Equal(3, result.Count);
        
Assert.Equal(0, result[0].Index);
Assert.Equal("One", result[0].Item);

Assert.Equal(1, result[1].Index);
Assert.Equal("Two", result[1].Item);
        
Assert.Equal(2, result[2].Index);
Assert.Equal("Three", result[2].Item);

以下に EnumerableExtensions.WithoutIndex の使用例を示します。

var data = new List<string> { "One", "Two", "Three" }.WithIndex();
var result = data.WithoutIndex().ToList();
        
Assert.Equal(3, result.Count);
Assert.Equal("One", result[0]);
Assert.Equal("Two", result[1]);
Assert.Equal("Three", result[2]);
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on MmsCore.Extensions:

Package Downloads
MmsCore.Excel

MmsCore.Excel provides efficient functionalities for reading and writing Excel files. Key classes include ExcelReader, ExcelWriter, ExcelAccessorFactory, ExcelWorksheetReader, and ExcelWorksheetWriter. These classes make it easy to manipulate Excel files.

MmsCore.Expressions

MmsCore.Expressions provide static classes ExpressionSupport, FieldAccessor, and PropertyAccessor for parsing lambda expressions and accessing public fields and properties. These classes enable the extraction of field and property names from lambda expressions described by expression trees, allowing developers to manipulate expression trees, object fields, and properties more efficiently.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.2.2 354 6/7/2024
0.2.1 1,483 2/29/2024
0.2.0 175 2/29/2024
0.1.2 277 2/19/2024
0.1.1 206 2/11/2024
0.1.0 106 2/11/2024
0.0.1-beta.5 127 1/21/2024
0.0.1-beta.4 105 1/12/2024
0.0.1-beta.3 77 1/12/2024
0.0.1-beta.2 91 1/10/2024
0.0.1-beta.1 94 1/9/2024