/// <summary>
        /// Given a single item function that should be a static method, this builds a serialized version of
        /// that method that should be enough to "recover" it, assuming it is a "recoverable" method (recoverable
        /// here is a loose definition, meaning that <see cref="DeserializeStaticDelegateOrNull"/> is capable
        /// of creating it, which includes among other things that it's static, non-lambda, accessible to
        /// this assembly, etc.).
        /// </summary>
        /// <param name="func">The method that should be "recoverable"</param>
        /// <returns>A string array describing the input method</returns>
        public static byte[] GetSerializedStaticDelegate(ExtLambdaTransform.LoadDelegate func)
        {
            Contracts.CheckValue(func, nameof(func));
            Contracts.CheckParam(func.Target == null, nameof(func), "The load delegate must be static");
            Contracts.CheckParam(Utils.Size(func.GetInvocationList()) <= 1, nameof(func),
                                 "The load delegate must not be a multicast delegate");

            var meth = func.GetMethodInfo();

            using (var ms = new MemoryStream())
            {
                var formatter = new BinaryFormatter();
#if CORECLR
                var m = new CoreHackMethodInfo();
                m.AssemblyName = meth.Module.Assembly.FullName;
                m.MethodName   = meth.Name;
                m.ClassName    = meth.DeclaringType.ToString();
                formatter.Serialize(ms, m);
#else
                formatter.Serialize(ms, meth);
#endif
                var result = ms.ToArray();
                // I assume it must be impossible to serialize in 0 bytes.
                Contracts.Assert(Utils.Size(result) > 0);
                return(result);
            }
        }