Skip to content

Can't use getter/setters in objects  #352

Closed

Description

@atotalnoob

System information

  • OS version/distro: Windows 10
  • .NET Version (eg., dotnet --info): 2.1.200

Issue

  • What did you do? Trying to use a JSON object that has been deserialized into C# classes

  • What happened? Using getter/setters causes errors with trying to decorate the columns.
    Okay:
    [Column("0")]
    public string Label;
    Not okay:
    [Column("0")]
    public string Label { get; set; }

  • What did you expect? To be able to use getter/setters. Without them, it makes everything a PITA

Source code / logs

Please paste or attach the code or logs or traces that would be helpful to diagnose the issue you are reporting.

Class I am using to deserialize:

    public class Intent
    {
        [Column("0")]
        [ColumnName("Label")]
        public string Label;
        [Column("1")]
        public List<string> Patterns = new List<string>();
    }

Loading in intent data with this:

 public static class IntentLoader
    {

        public static List<Intent> LoadIntentData()
        {
            var fileContents = System.IO.File.ReadAllText("intents.json");

            try
            {
               var intents = JsonConvert.DeserializeObject<List<Intent>>(fileContents);
                return intents;
            }
            catch (Exception e)
            {

                throw e;
            }
            
        }
    }

Activity

  1. Ivanidzo4ka commented on Oct 18, 2018

    @Ivanidzo4ka
    Contributor

    DRI RESPONSE: Was solved via #616.

  2. ghost locked as resolved and limited conversation to collaborators on Mar 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions