Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Teste t  = new Teste();
            Teste t2 = t;

            Console.WriteLine(t.Equals(t));
            Console.WriteLine(t.GetHashCode());
            Console.WriteLine(t2.GetHashCode());
            Console.WriteLine(t.GetType());
            Console.WriteLine(t.ToString());

            Console.ReadKey();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            var classe = new Teste();
            var type   = classe.GetType();                                           // pega o tipo da instancia

            var attributes = type.GetCustomAttributes(typeof(DeveloperInfo), false); //pega todos os atributos que são desse tipo

            foreach (var attribute in attributes)
            {
                var devInfo = (DeveloperInfo)attribute;
                Console.WriteLine((devInfo.EmailAddress));
                Console.WriteLine(devInfo.Revision);
            }

//#pragma warning disable 0618 // diretiva de compilação para ignorar o warning.
//          QualquerCoisa();
//#pragma warning restore 0618
        }