I have a few statements like these:
if (mediaCode.IndexOf(',') > 0) {
entries = entries.Where(c => mediaCode.Contains(c.Mediacode));
}
else {
entries = entries.Where(c => c.Mediacode == mediaCode);
}
then:
if (contentType.IndexOf(',') > 0) {
entries = entries.Where(c => contentType.Contains(c.Contenttype));
}
else {
entries = entries.Where(c => c.Contenttype == contentType);
}
I would like to create a function where i just pass the string and the property, something like: MethodName(contentType, c.Contenttype)
How could this be done?
Aucun commentaire:
Enregistrer un commentaire