Error creating PIValue object?

Discussion created by AlistairFrith on May 21, 2013
Latest reply on May 21, 2013 by AlistairFrith

I am trying to create PIValue objects but I keep getting "PIValue is not properly initialized."


Here is my code: 

/// <summary>
/// Returns a new PIValue object which is valid (although the value is 'NaN')
/// </summary>
/// <returns></returns>
private PIValue NewPIValue()
    PIValue result = new PIValue();
    result.Value = double.NaN;
    result.TimeStamp.LocalDate = DateTime.Now;

    return result;

The exception is raised on the line where I set the date. I have tried several different permutations but they all result in an invalid object. How do I do this?


--- Alistair.