I have the following class Record:
public class Record
{
public string Station;
public string UserName;
public int EvtActive;
public string EvtTime;
public string EvtTimeString;
public string LocCode;
public string LastLoop;
public int CompLvl;
public int RecordID;
public string ConnectTime;
public string Notes;
public string Color;
public Record(string a, string b, int c, string d, string e, string f, string g, int h, int i, string j, string k)
{
this.Station = a;
this.UserName = b;
this.EvtActive = c;
this.EvtTime = d;
this.EvtTimeString = e;
this.LocCode = f;
this.LastLoop = g;
this.CompLvl = h;
this.RecordID = i;
this.ConnectTime = j;
this.Notes = k;
this.Color = get_color(this.LocCode);
SwordsServer.record_list.Add(this);
Console.WriteLine("Creating Record");
Console.WriteLine(this.Station);
Console.WriteLine(this.UserName);
Console.WriteLine(this.LocCode);
}
When I do something like:
Record r = new Record("Support-28", "TEST USER", 0, "", "", "TEST CODE", "", 0, 0, "", "")
I will see r.Station, r.UserName, and r.LocCode print out in Console.
Though, when I use JSON like this:
Record json_record = JsonConvert.DeserializeObject<Record>(System.Text.Encoding.ASCII.GetString(byte_slice))
I see nothing but
Creating Record
in my printout.
What's even more confusing is that if I add:
Console.WriteLine(json_record.LocCode)
immediately under the JsonConvert line, I do actually get the appropriate print out. Yet the get_color function gets "" passed into it.
This seems as if using JSON to create an object does not function the way I need it to. What am I missing?