Advertisement
Geralt1001

zad 6.4

Oct 23rd, 2016
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.42 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Mwzad64
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             System.Reflection.MemberInfo info = typeof(ReflectionExample);
  14.             // pobranie listy atrybutów
  15.             Type type = typeof(ReflectionExample);
  16.             var foo = Activator.CreateInstance(type);
  17.             //MethodInfo inf = t.Get
  18.  
  19.  
  20.             object[] attributes = info.GetCustomAttributes(true);
  21.             for (int i = 0; i < attributes.Length; i++)
  22.             {
  23.                 // Wypisujemy wszystkie atrybuty
  24.                 Console.WriteLine(attributes[i]);
  25.             }
  26.             Console.ReadKey();
  27.             // Wynik działania programu
  28.             // Refleksja.ReflectionExample
  29.         }
  30.  
  31.        
  32.         public class ReflectionExample
  33.         {
  34.             int wl1{ get; set; }
  35.             string wl2 { get; set; }
  36.             DateTime wl3 { get; set; }
  37.  
  38.             public int pl1 { private get; set; }
  39.             public string pl2 { get; private set; }
  40.             public static DateTime pl3 { get; set; }
  41.  
  42.             public int met1(int x)
  43.             {
  44.                 return x;
  45.             }
  46.  
  47.             public static string met2(string a, string b)
  48.             {
  49.                 return a + ' ' + b;
  50.             }
  51.         }
  52.     }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement