public void CreateTypeConstructorCreateStaticField() { var classEmitter = new CustomClassEmitter(Scope, "CreateTypeConstructorCreateStaticField", typeof(object)); FieldReference field = classEmitter.CreateStaticField("s_test", typeof(string)); classEmitter.CreateTypeConstructor().CodeBuilder .AddStatement(new AssignStatement(field, (new ConstReference("Yay").ToExpression()))) .AddStatement(new ReturnStatement()); Type t = classEmitter.BuildType(); Assert.That(t.GetField("s_test").GetValue(null), Is.EqualTo("Yay")); }