ShortCleanLinqExtensions 1.0.1
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package ShortCleanLinqExtensions --version 1.0.1
NuGet\Install-Package ShortCleanLinqExtensions -Version 1.0.1
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="ShortCleanLinqExtensions" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ShortCleanLinqExtensions" Version="1.0.1" />
<PackageReference Include="ShortCleanLinqExtensions" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ShortCleanLinqExtensions --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: ShortCleanLinqExtensions, 1.0.1"
#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.
#:package ShortCleanLinqExtensions@1.0.1
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ShortCleanLinqExtensions&version=1.0.1
#tool nuget:?package=ShortCleanLinqExtensions&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Short clean linq extensions
Sce is a .NET Nuget extensions to make things easier.
Installation
.NET CLI
dotnet add package ShortCleanLinqExtensions --version 1.0.0
Package Manager Console
NuGet\Install-Package ShortCleanLinqExtensions -Version 1.0.0
Usage
using ShortCleanLinqExtensions.src.Extensions;
# Title
"ula leila".Title();
// Output: Ula Leila
# Slug
"ula leila".Stug();
// Output: ula-leila
# Mask
"ula leila".Mask("*", 4);
// Output: ula *****
# Snake Case
"UlaLeila".Snake();
// Output: ula_leila
# Is Json
"[1,2,3]".IsJson();
// Output: true
# List To Json
var list = new List<string>() { "1", "2", "3" };
list.ToJson();
// Output: ["1","2","3"]
# List Collapse
var listC1 = new List<int>() { 4, 5, 6, 7 };
var listC2 = new List<int>() { 4, 5, 6, 7 };
var manyList = new List<List<int>>() { listC1, listC2 };
var listCollapsed = manyList
.Collapse()
.ToList();
Console.WriteLine("Collapse => " + listCollapsed.ToJson());
// Output: [4,5,6,7,4,5,6,7]
# Paginate API
var list = new List<string>() { "1", "2", "3" };
var listPagineted = list
.AsQueryable()
.Paginate(1, 10);
// Output: {"Page":1,"Limit":10,"FirstPage":null,"LastPage":null,"Total":3,"NextPage":null,"PreviousPage":null,"Data":["1","2","3"]}
# Paginate MVC or Razor Pages
public class IndexModel : PageModel
{
private readonly ILogger<IndexModel> _logger;
public readonly List<string> _dataSet;
private readonly IHttpContextAccessor _httpContextAccessor;
public PagedResponse<List<string>> Items { get; set; }
public IndexModel(ILogger<IndexModel> logger, IHttpContextAccessor httpContextAccessor)
{
_logger = logger;
_dataSet = new List<string>()
{
"joao",
"joao1",
"joao2",
"joao3",
"joao4",
"joao5",
"joao6",
"joao7",
};
_httpContextAccessor = httpContextAccessor;
}
public void OnGet([FromQuery] int page = 1, [FromQuery] int limit = 2)
{
Items = _dataSet
.AsQueryable()
.Paginate(page, limit, Request, _httpContextAccessor);
}
}
...Index.cshtml
@Html.Raw(Model.Items.Links())
//output:
<img src="./DOC/paginate-web.png" />
# When
bool condition = true;
var newListFiltered = listC1
.AsQueryable()
.When(condition, l => l.Equals(4))
.ToList();
// Output: [4]
# Diff
List<int> firstList = new List<int>() { 1, 2, 3, 4, 5 };
List<int> secondList = new List<int>() { 2, 4, 6, 8 };
IEnumerable<int> diff = firstList.Diff(secondList);
// Output: String.Join(',', diff) => 1,3,5
## Contributing
Pull requests are welcome. For major changes, please open an issue first
to discuss what you would like to change.
Please make sure to update tests as appropriate.
## License
[MIT](https://choosealicense.com/licenses/mit/)
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. 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 was computed. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net7.0
- Microsoft.AspNetCore.Http.Abstractions (>= 2.2.0)
- Microsoft.AspNetCore.WebUtilities (>= 2.2.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.