GetValue() public static method

public static GetValue ( TypeSpec nullableType ) : MethodSpec
nullableType TypeSpec
return MethodSpec
Ejemplo n.º 1
0
        public override void Emit(EmitContext ec)
        {
            var call = new CallEmitter();

            call.InstanceExpression = Child;
            call.EmitPredefined(ec, NullableInfo.GetValue(Child.Type), null);
        }
Ejemplo n.º 2
0
        public override void Emit(EmitContext ec)
        {
            Store(ec);

            var call = new CallEmitter();

            call.InstanceExpression = this;

            //
            // Using GetGetValueOrDefault is prefered because JIT can possibly
            // inline it whereas Value property contains a throw which is very
            // unlikely to be inlined
            //
            if (useDefaultValue)
            {
                call.EmitPredefined(ec, NullableInfo.GetGetValueOrDefault(expr.Type), null);
            }
            else
            {
                call.EmitPredefined(ec, NullableInfo.GetValue(expr.Type), null);
            }
        }