public FastestTreeSerialisationNotPossibleException(string typeName, ImpossibleMemberDetails memberIfAny) : base(GetMessage(typeName, memberIfAny)) { if (string.IsNullOrWhiteSpace(typeName)) { throw new ArgumentException($"Null/blank {nameof(typeName)} specified"); } TypeName = typeName; MemberIfAny = memberIfAny; }
private static string GetMessage(string typeName, ImpossibleMemberDetails memberIfAny) { if (string.IsNullOrWhiteSpace(typeName)) { throw new ArgumentException($"Null/blank {nameof(typeName)} specified"); } if (memberIfAny == null) { return($"The type {typeName} does not allow optimal fastest tree binary serialisation - since no specific member is identified as a problem, it is presumably because the type is a non-sealed class"); } return($"The type {typeName} does not allow optimal fastest tree binary serialisation because the member {memberIfAny.Name} of type {memberIfAny.TypeName} does not allow it (presumably because the type is a non-sealed class)"); }