Microsoft.CSharp.RuntimeBinder.Semantics.ExprFactory.CreateZeroInit C# (CSharp) Method

CreateZeroInit() public method

public CreateZeroInit ( CType pType ) : EXPR
pType CType
return EXPR
        public EXPR CreateZeroInit(CType pType)
        {
            EXPRCLASS exprClass = MakeClass(pType);
            return CreateZeroInit(exprClass);
        }

Same methods

ExprFactory::CreateZeroInit ( Microsoft.CSharp.RuntimeBinder.Semantics.EXPRTYPEORNAMESPACE pTypeExpr ) : EXPR
ExprFactory::CreateZeroInit ( Microsoft.CSharp.RuntimeBinder.Semantics.EXPRTYPEORNAMESPACE pTypeExpr, EXPR pOptionalOriginalConstructorCall, bool isConstructor ) : EXPR

Usage Example

            private bool bindImplicitConversionFromNull()
            {
                // null type can be implicitly converted to any reference type or pointer type or type
                // variable with reference-type constraint.

                FUNDTYPE ftDest = _typeDest.FundamentalType;
                if (ftDest != FUNDTYPE.FT_REF && ftDest != FUNDTYPE.FT_PTR &&
                    // null is convertible to System.Nullable<T>.
                    !_typeDest.IsPredefType(PredefinedType.PT_G_OPTIONAL))
                {
                    return false;
                }
                if (_needsExprDest)
                {
                    // If the conversion argument is a constant null then return a ZEROINIT.
                    // Otherwise, bind this as a cast to the destination type. In a later
                    // rewrite pass we will rewrite the cast as SEQ(side effects, ZEROINIT).
                    _exprDest = _exprSrc is ExprConstant
                        ? ExprFactory.CreateZeroInit(_typeDest)
                        : ExprFactory.CreateCast(_typeDest, _exprSrc);
                }
                return true;
            }
All Usage Examples Of Microsoft.CSharp.RuntimeBinder.Semantics.ExprFactory::CreateZeroInit