Using this to check if c is an instance of TForm.
c.GetType().Name.CompareTo("TForm") == 0
Is there a more type safe way to do it besides using a string as a param to CompareTo()?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The different answers here have two different meanings.
If you want to check whether an instance is of an exact type then
is the way to go.
If you want to know whether
cis an instance ofTFormor a subclass then useis/as:or
It’s worth being clear in your mind about which of these behaviour you actually want.