Program.cs 636 B

123456789101112131415161718192021222324
  1. using ClassLibrary1;
  2. using System;
  3. using System.Linq;
  4. using System.Reflection;
  5. namespace ConsoleApp4
  6. {
  7. class Program
  8. {
  9. static void Main(string[] args)
  10. {
  11. Assembly assembly = Assembly.GetCallingAssembly();
  12. var typesWithMyAttribute =
  13. from t in assembly.GetTypes()
  14. let attributes = t.GetCustomAttributes(typeof(CosmosDBAttribute), false)
  15. where attributes != null && attributes.Length > 0
  16. select new { Type = t, Attributes = attributes.Cast<CosmosDBAttribute>() };
  17. Console.WriteLine("Hello World!");
  18. }
  19. }
  20. }