<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://nfex.ru/index.php?action=history&amp;feed=atom&amp;title=Csharp%2FCSharp_Tutorial%2FReflection%2FAttributes</id>
		<title>Csharp/CSharp Tutorial/Reflection/Attributes - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://nfex.ru/index.php?action=history&amp;feed=atom&amp;title=Csharp%2FCSharp_Tutorial%2FReflection%2FAttributes"/>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/Reflection/Attributes&amp;action=history"/>
		<updated>2026-04-30T01:38:51Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/Reflection/Attributes&amp;diff=5954&amp;oldid=prev</id>
		<title> в 15:31, 26 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/Reflection/Attributes&amp;diff=5954&amp;oldid=prev"/>
				<updated>2010-05-26T15:31:53Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 15:31, 26 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/Reflection/Attributes&amp;diff=5955&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/Reflection/Attributes&amp;diff=5955&amp;oldid=prev"/>
				<updated>2010-05-26T12:17:50Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Get Custom Attributes==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System;&lt;br /&gt;
using System.Reflection;&lt;br /&gt;
class Program {&lt;br /&gt;
    static void Main(string[] args) {&lt;br /&gt;
        string assemblyName = &amp;quot;Your&amp;quot;;&lt;br /&gt;
        try {&lt;br /&gt;
            Assembly a = Assembly.LoadFrom(assemblyName);&lt;br /&gt;
            object[] attributes = a.GetCustomAttributes(true);&lt;br /&gt;
            if (attributes.Length &amp;gt; 0) {&lt;br /&gt;
                Console.WriteLine(&amp;quot;Assembly attributes for &amp;quot;{0}&amp;quot;...&amp;quot;, assemblyName);&lt;br /&gt;
                foreach (object o in attributes)&lt;br /&gt;
                    Console.WriteLine(&amp;quot;  {0}&amp;quot;, o.ToString());&lt;br /&gt;
            } else&lt;br /&gt;
                Console.WriteLine(&amp;quot;Assembly {0} contains no Attributes.&amp;quot;, assemblyName);&lt;br /&gt;
        } catch (Exception ex) {&lt;br /&gt;
            Console.WriteLine(ex.ToString());&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Using Reflection to get Custom Attributes==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using System.Text;&lt;br /&gt;
    [AttributeUsage(AttributeTargets.Class |&lt;br /&gt;
                    AttributeTargets.Constructor |&lt;br /&gt;
                    AttributeTargets.Field |&lt;br /&gt;
                    AttributeTargets.Method |&lt;br /&gt;
                    AttributeTargets.Property,&lt;br /&gt;
                    AllowMultiple = true)]&lt;br /&gt;
    public class BugFixAttribute : System.Attribute&lt;br /&gt;
    {&lt;br /&gt;
        public BugFixAttribute(int bugID,string programmer,string date){&lt;br /&gt;
            this.BugID = bugID;&lt;br /&gt;
            this.Programmer = programmer;&lt;br /&gt;
            this.Date = date;&lt;br /&gt;
        }&lt;br /&gt;
        public int BugID;&lt;br /&gt;
        public string Date;&lt;br /&gt;
        public string Programmer;&lt;br /&gt;
        public string Comment { get; set; }&lt;br /&gt;
    }&lt;br /&gt;
    [BugFixAttribute(1, &amp;quot;A&amp;quot;, &amp;quot;01/04/05&amp;quot;,Comment = &amp;quot;value&amp;quot;)]&lt;br /&gt;
    public class MyMath{&lt;br /&gt;
        public double DoFunc1(double param1)&lt;br /&gt;
        {&lt;br /&gt;
            return param1 + DoFunc2(param1);&lt;br /&gt;
        }&lt;br /&gt;
        public double DoFunc2(double param1)&lt;br /&gt;
        {&lt;br /&gt;
            return param1 / 3;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    public class Tester&lt;br /&gt;
    {&lt;br /&gt;
        public static void Main()&lt;br /&gt;
        {&lt;br /&gt;
            MyMath mm = new MyMath();&lt;br /&gt;
            System.Reflection.MemberInfo inf = typeof(MyMath);&lt;br /&gt;
            object[] attributes;&lt;br /&gt;
            attributes = inf.GetCustomAttributes(typeof(BugFixAttribute), false);&lt;br /&gt;
            foreach (Object attribute in attributes)&lt;br /&gt;
            {&lt;br /&gt;
                BugFixAttribute bfa = (BugFixAttribute)attribute;&lt;br /&gt;
                Console.WriteLine(&amp;quot;\nBugID: {0}&amp;quot;, bfa.BugID);&lt;br /&gt;
                Console.WriteLine(&amp;quot;Programmer: {0}&amp;quot;, bfa.Programmer);&lt;br /&gt;
                Console.WriteLine(&amp;quot;Date: {0}&amp;quot;, bfa.Date);&lt;br /&gt;
                Console.WriteLine(&amp;quot;Comment: {0}&amp;quot;, bfa.rument);&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
    }&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>