![]() |
VOOZH | about |
dotnet add package Serialize.Linq --version 4.4.1
NuGet\Install-Package Serialize.Linq -Version 4.4.1
<PackageReference Include="Serialize.Linq" Version="4.4.1" />
<PackageVersion Include="Serialize.Linq" Version="4.4.1" />Directory.Packages.props
<PackageReference Include="Serialize.Linq" />Project file
paket add Serialize.Linq --version 4.4.1
#r "nuget: Serialize.Linq, 4.4.1"
#:package Serialize.Linq@4.4.1
#addin nuget:?package=Serialize.Linq&version=4.4.1Install as a Cake Addin
#tool nuget:?package=Serialize.Linq&version=4.4.1Install as a Cake Tool
Serialize.Linq is a .NET library that provides functionality to serialize and deserialize LINQ expressions. This library is useful in scenarios where you need to send LINQ expressions over the wire or persist them in a database.
BinaryFormatter. For more details, see the BinaryFormatter Security Guide.You can install Serialize.Linq via NuGet:
Install-Package Serialize.Linq
Here's a simple example of how to use Serialize.Linq:
// Create an expression
Expression<Func<int, bool>> expression = num => num < 5;
// Create a serializer
var serializer = new ExpressionSerializer(new JsonSerializer());
// Serialize the expression
string serializedExpression = serializer.SerializeText(expression);
// Deserialize the expression
var deserializedExpression = serializer.DeserializeText(serializedExpression);
Deserializing an expression reconstructs Types by name from the payload. When the payload is
untrusted, supply an ITypeFilter on an ExpressionContext to allow-list the permitted types —
the equivalent of BinaryFormatter's SerializationBinder. Any type the filter rejects throws a
TypeNotAllowedException.
using Serialize.Linq;
using Serialize.Linq.TypeFilters;
// Only allow the types your expressions actually use.
var filter = new AllowedTypesFilter(typeof(int), typeof(bool), typeof(object), typeof(Func<,>))
.AllowNamespace("MyApp.Models");
var context = new ExpressionContext(filter);
var deserializedExpression = serializer.DeserializeText(serializedExpression, context);
AllowedTypesFilter matches explicit types (use the open definition for generics, e.g.
typeof(List<>)) and whole namespaces; DelegateTypeFilter wraps an arbitrary
Func<Type, bool> predicate. The filter is checked for every resolved type, including each
generic argument. With no context/filter, all types resolve as before.
We welcome contributions to Serialize.Linq! If you'd like to contribute, please fork the repository, make your changes, and submit a pull request. If you're not sure where to start, take a look at our open issues.
For bugs: make sure you create a unit test, so it is easier for me to reproduce and fix it.
You can always buy me a coffee ☕.
Serialize.Linq has a comprehensive test suite. You can run the tests using your preferred test runner.
Serialize.Linq is licensed under the MIT License. See the LICENSE file for more details.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 is compatible. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 is compatible. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 is compatible. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 is compatible. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 is compatible. net481 net481 is compatible. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 5 NuGet packages that depend on Serialize.Linq:
| Package | Downloads |
|---|---|
|
VirtoCommerce.Platform.Data
Virto Commerce is a flexible B2B ecommerce solution that offers powerful tools for enterprise business users. https://virtocommerce.com |
|
|
VirtoCommerce.XDigitalCatalog
Package Description |
|
|
OO.AppBase
Easy Application Base module |
|
|
CoreRemoting
Easy to use Remoting library for .NET Core and .NET Framework |
|
|
Tewr.BlazorWorker.BackgroundService
Use dotnet Web Workers Threads in Blazor |
Showing the top 5 popular GitHub repositories that depend on Serialize.Linq:
| Repository | Stars |
|---|---|
|
microsoft/GraphEngine
Microsoft Graph Engine
|
|
|
VirtoCommerce/vc-platform
Virto Commerce B2B Innovation Platform
|
|
|
lofcz/LLMTornado
The .NET library to build AI agents with 30+ built-in connectors.
|
|
|
Tewr/BlazorWorker
Library for creating DotNet Web Worker threads/multithreading in Client side Blazor
|
|
|
ngs-doo/revenj
DSL Platform compatible backend
|
| Version | Downloads | Last Updated | |
|---|---|---|---|
| 4.4.1 | 829 | 6/16/2026 | |
| 4.4.0 | 1,109 | 6/16/2026 | |
| 4.3.0 | 94 | 6/16/2026 | |
| 4.2.0 | 81 | 6/16/2026 | |
| 4.1.0 | 536 | 6/16/2026 | |
| 4.0.167 | 1,130,348 | 1/19/2025 | |
| 4.0.0 | 91 | 6/16/2026 | 4.0.0 is deprecated because it has critical bugs. |
| 3.1.160 | 587,774 | 9/29/2024 | |
| 3.0.152 | 1,230,145 | 2/8/2024 | |
| 3.0.148 | 213,935 | 10/21/2023 | |
| 3.0.136 | 1,214 | 10/21/2023 | |
| 3.0.134 | 580,467 | 6/24/2023 | |
| 3.0.133 | 8,933 | 6/10/2023 | |
| 3.0.126 | 1,538 | 6/10/2023 | |
| 2.0.0 | 1,641,756 | 12/12/2020 | |
| 1.8.1 | 2,231,974 | 4/25/2019 | |
| 1.8.0 | 2,287 | 4/25/2019 | |
| 1.7.3.1 | 96,752 | 10/26/2018 | |
| 1.7.1 | 175,416 | 6/2/2018 | |
| 1.7.0 | 19,355 | 3/20/2018 |
- restrict types allowed during deserialization via ITypeFilter on ExpressionContext