C#C
C#3y ago
nulled

❔ using data received from a Post to determine what property to set

Below will be attached text of two classes, one called PostReceiveStruct and the other UserAccount.

UserAccount holds the structed for a json format that can be turned into an object.

PostReceiveStruct holds the structure for how data received from a post request can be turned into an object as well

Both of these classes work to what I need them for, what I would like to know is how can use DCName's value to use in UserAccount

The easiest example that I can think of is something like what they do in rLua.

local DCName = "version"
UserAccount[DCName]


public class PostReceiveStruct
    {
        public ulong uid { get; set; }
        public string DCName { get; set; }
        public string DCValue { get; set; }
    }


public class Medal
    {
        public string name { get; set; }
        public int awarded { get; set; }
        public int permission { get; set; }
    }
    public class BranchMedals
    {
        public List<Medal> medal { get; set; }
    }
    public class BranchList
    {
        public List<BranchMedals> branches { get; set; }
    }
    public class UserAccount
    {
        public ulong RID { get; set; }
        public ulong ID { get; set; }
        public string version { get; set; }
        public dynamic medals {get;set;}
    }
Was this page helpful?