diff --git a/ObjectPrinting/MemberInfoExtension.cs b/ObjectPrinting/MemberInfoExtension.cs
new file mode 100644
index 00000000..5d1f88b6
--- /dev/null
+++ b/ObjectPrinting/MemberInfoExtension.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Reflection;
+
+namespace ObjectPrinting
+{
+ public static class MemberInfoExtension
+ {
+ public static object GetMemberValue(this MemberInfo memberInfo, object obj)
+ {
+ return memberInfo switch
+ {
+ PropertyInfo propertyInfo => propertyInfo.GetValue(obj),
+ FieldInfo fieldInfo => fieldInfo.GetValue(obj),
+ _ => throw new InvalidOperationException()
+ };
+ }
+
+ public static Type GetMemberType(this MemberInfo memberInfo)
+ {
+ return memberInfo switch
+ {
+ PropertyInfo propertyInfo => propertyInfo.PropertyType,
+ FieldInfo fieldInfo => fieldInfo.FieldType,
+ _ => throw new InvalidOperationException()
+ };
+ }
+ }
+}
\ No newline at end of file
diff --git a/ObjectPrinting/ObjectPrinting.csproj b/ObjectPrinting/ObjectPrinting.csproj
index 1c5eaf1c..730c9586 100644
--- a/ObjectPrinting/ObjectPrinting.csproj
+++ b/ObjectPrinting/ObjectPrinting.csproj
@@ -1,14 +1,16 @@
-
- 8
- netcoreapp3.1
- false
-
+
+ 9.0
+ net8.0
+ false
+
-
-
-
-
+
+
+
+
+
+
diff --git a/ObjectPrinting/PrintingConfig.cs b/ObjectPrinting/PrintingConfig.cs
index a9e08211..ba561eba 100644
--- a/ObjectPrinting/PrintingConfig.cs
+++ b/ObjectPrinting/PrintingConfig.cs
@@ -1,41 +1,190 @@
using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.Immutable;
+using System.Globalization;
using System.Linq;
+using System.Linq.Expressions;
+using System.Reflection;
using System.Text;
namespace ObjectPrinting
{
public class PrintingConfig
{
+ private static readonly HashSet _finalTypes = new()
+ {
+ typeof(int), typeof(uint), typeof(double), typeof(float), typeof(decimal),
+ typeof(long), typeof(ulong), typeof(short), typeof(ushort),
+ typeof(string), typeof(bool),
+ typeof(DateTime), typeof(TimeSpan), typeof(Guid)
+ };
+
+ private readonly HashSet excludedProperties = new();
+ private readonly HashSet excludedTypes = new();
+ protected readonly Dictionary propertiesMaxLength = new();
+ protected readonly Dictionary> propertiesSerialization = new();
+ protected readonly Dictionary typesCulture = new();
+ protected readonly Dictionary> typesSerialization = new();
+ private Func recursivePropertiesSerialization;
+
+ public PrintingConfig()
+ {
+ }
+
+ protected PrintingConfig(PrintingConfig config)
+ {
+ typesCulture = config.typesCulture;
+ propertiesMaxLength = config.propertiesMaxLength;
+ propertiesSerialization = config.propertiesSerialization;
+ typesSerialization = config.typesSerialization;
+ }
+
public string PrintToString(TOwner obj)
{
- return PrintToString(obj, 0);
+ return SerializeObject(obj, ImmutableList