Skip to content

Can't use getter/setters in objects #352

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
atotalnoob opened this issue Jun 13, 2018 · 1 comment
Closed

Can't use getter/setters in objects #352

atotalnoob opened this issue Jun 13, 2018 · 1 comment
Labels
API Issues pertaining the friendly API

Comments

@atotalnoob
Copy link

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;
            }
            
        }
    }
@Ivanidzo4ka
Copy link
Contributor

DRI RESPONSE: Was solved via #616.

@Ivanidzo4ka Ivanidzo4ka added API Issues pertaining the friendly API Answered labels Oct 18, 2018
@ghost ghost locked as resolved and limited conversation to collaborators Mar 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
API Issues pertaining the friendly API
Projects
None yet
Development

No branches or pull requests

2 participants