T
Tony Johansson
Hello!
In this code I use the GetType and it works but I just wonder if it exist
any better way to get the runtime type.
public Animal GetElement(string name, string animalType)
{
return (Animal)animals.Find(delegate(Animal item)
{
return string.Equals(item.Name, name,
StringComparison.CurrentCultureIgnoreCase) &&
string.Equals(item.GetType().ToString().Substring(item.GetType().ToString().LastIndexOf(".")
+ 1), animal, StringComparison.CurrentCultureIgnoreCase);
});
}
//Tony
In this code I use the GetType and it works but I just wonder if it exist
any better way to get the runtime type.
public Animal GetElement(string name, string animalType)
{
return (Animal)animals.Find(delegate(Animal item)
{
return string.Equals(item.Name, name,
StringComparison.CurrentCultureIgnoreCase) &&
string.Equals(item.GetType().ToString().Substring(item.GetType().ToString().LastIndexOf(".")
+ 1), animal, StringComparison.CurrentCultureIgnoreCase);
});
}
//Tony