vendredi 13 mars 2020

c# how to get input buffer property value as string

I need to get the value of each property in an inputbuffer, I can get the name of the property but I can't get the value, I need to add the name and the value in a dictionary. This is my code:

public override void Input0_ProcessInputRow(Input0Buffer Row)
{
    Dictionary<string, string> body = new Dictionary<string, string>();

    foreach (PropertyInfo inputColumn in Row.GetType().GetProperties())
    {
        if (!inputColumn.Name.EndsWith("IsNull"))
                body.Add(inputColumn.Name, Row.GetType().GetProperty(inputColumn.Name).GetValue(Row).ToString() );
    }
}

I got this exception: Object reference not set to an instance of an object





Aucun commentaire:

Enregistrer un commentaire