Alex Campos
Alex Campos

Reputation: 11

Error with Ref parameter

    public Resultado Procesar_Respuesta_Estructurada(ref object ObjetoIN, ref string Login, string NombreMetodo)
    {
        int i = 0;
        Resultado ObjetoOUT = default(Resultado);
        bool Errors_Warning = false;
        Utilitarios OUtil = default(Utilitarios);
        try
        {

            OUtil = new Utilitarios();
            ObjetoOUT = new Resultado();

            ObjetoOUT.Success =  ObjetoIN.Success;
            ObjetoOUT.ExistWarnings = ObjetoIN.ExistWarnings;
            ObjetoOUT.Items = ObjetoIN.Items;

            if ((ObjetoIN.Errors != null) && ObjetoIN.Errors.Length > 0)
            {
                Errors_Warning = true;

the error is in ObjetoIN.Success

Error 3 'object' does not contain a definition for 'Success' and no extension method 'Success' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)

Upvotes: 1

Views: 85

Answers (1)

Brian Rasmussen
Brian Rasmussen

Reputation: 116401

This has nothing to do with ref. The type of ObjetoIN is specified as object. However, object doesn't have a property or a field named Success and that's what the error message is telling you. You need to supply a valid type for ObjetoIN before you can access Success.

Upvotes: 2

Related Questions