locked
JsonValue does not contain a definition for 'ReadAs' and no accessible extension method 'ReadAs' error with "System.Json" RRS feed

  • Question

  • User2056817590 posted

     return json.ContainsKey(key) ? XmlConvert.ToDateTime(json[key].ReadAs<String>(), XmlDateTimeSerializationMode.Local) : DateTime.MinValue;

    Severity    Code    Description    Project    File    Line    Suppression State
    Error    CS1061    'JsonValue' does not contain a definition for 'ReadAs' and no accessible extension method 'ReadAs' accepting a first argument of type 'JsonValue' could be found (are you missing a using directive or an assembly reference?)    LBCT.N4.Model    C:\N4 Adapter\Microsoft.NET\Source\Projects\LBCT.N4.Model\Access\LBCTBaseAccess.cs    40    Active

    Tuesday, November 3, 2020 6:13 AM

All replies

  • User-1330468790 posted

    Hi kalvakrishna,

     

    Sorry that I could not directly target the problem based on the information that you provided.

     

    Would you mind telling me more details?

    • Is the class "JsonValue" of the type "System.Json"?
    • Do you use any extension assembly for the class "JsonValue"? Because I cannot find "ReadAs" in this class.

    Related Link: https://docs.microsoft.com/en-us/dotnet/api/system.json.jsonvalue?view=dotnet-plat-ext-3.1

     

    Thank you for understanding.

    Best regards,

    Sean

    Wednesday, November 4, 2020 8:56 AM
  • User-1330468790 posted

    Hi kalvakrishna,

     

    Any update on your problem?

    Sorry that I have got the reply from you hence I am not able to reproduce the problem.

    If you are still handling this problem, could you please share more information so that we would be able to help you.

     

    Best regards,

    Sean 

    Wednesday, November 18, 2020 8:13 AM