c# - using typeof() to search for all object -
public class classa { int num = 10; } classa = new classa(); classa b = new classa(); classa c = new classa(); a.gettype(); //we can result "classa" here question. anyway can object of classa using typeof(classa)? or other way? kind help if want get object of classa you may want organize classa instances collection , say, array , use linq : object[] source = new object[] { "string", new classa(), // new object(), new classa(), // , should filtered out null }; ... classa[] result = source .oftype<classa>() .where(item => item != null) // may want filter .toarray();