Im trying to get object keys from an object in C#. How to do that? For example: object Test has keys named Ticket, and Hash. How to get that?
internal class Test
{
public string Ticket { get; internal set; } = "TICKECIOR";
public object Hash {get; internal set; } = null;
}
I want it to output Ticket and hash. It needs to be compatible with other objects.
I try to use it like this:
List<string> l = new List<string>();
var obj = new Test {Ticket = "test val"};
// I need to get the keys name and add them to list.
l.Add("key name");