Chinchilla.Serializers.DefaultMessageTypeFactory.CreateFactory C# (CSharp) Метод

CreateFactory() приватный Метод

private CreateFactory ( Type interfaceType ) : Func
interfaceType System.Type
Результат Func
        private Func<object> CreateFactory(Type interfaceType)
        {
            var typeBuilder = moduleBuilder.Value.DefineType(
                interfaceType.Name + "_backing",
                TypeAttributes.Public | TypeAttributes.Class);

            typeBuilder.AddInterfaceImplementation(interfaceType);

            foreach (var interfaceProperty in interfaceType.GetProperties())
            {
                CreateProperty(typeBuilder, interfaceProperty);
            }

            var generatedType = typeBuilder.CreateType();

            var newExpression = Expression.New(generatedType);
            var lambda = Expression.Lambda(newExpression);
            return (Func<object>)lambda.Compile();
        }