.NET: Add F# backing field support to reflective serializer
@@ -1626,11 +1626,23 @@ namespace Apache.Ignite.Core.Impl.Binary
return hash;
}
+ /// <summary>
+ /// Cleans the name of the field.
+ /// </summary>
public static string CleanFieldName(string fieldName)
{
+ // C# auto property backing field:
if (fieldName.StartsWith("<", StringComparison.Ordinal)
&& fieldName.EndsWith(">k__BackingField", StringComparison.Ordinal))
+ {
return fieldName.Substring(1, fieldName.IndexOf(">", StringComparison.Ordinal) - 1);
+ }
+
+ // F# backing field:
+ if (fieldName.EndsWith("@", StringComparison.Ordinal))
+ {
+ return fieldName.Substring(0, fieldName.Length - 1);
+ }
return fieldName;
}
