I have a HTML input
in my web app, where the user can enter some sort of filter criteria:
Type='Person' && Name='Bob' && Hobby='Reading'
Say I have a C# classes:
public abstract class Something {
public string Type { get; set; }
}
public class Person:Something {
public string Name { get; set; }
public string Hobby { get; set; }
}
public class Animal:Something {
public string Breed { get; set; }
public string Color { get; set; }
}
Then I have some sort of Processor method:
Process(Something obj) {
// use the user text to decide what to do
}
How would I:
- Go about parsing the user entered text, to indicate if it is valid or invalid?
- Map the entered text into my incoming object in Process?
Thanks.
Aucun commentaire:
Enregistrer un commentaire