<?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%2FAttribute%2FConditional_Attribute</id>
		<title>Csharp/CSharp Tutorial/Attribute/Conditional Attribute - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://nfex.ru/index.php?action=history&amp;feed=atom&amp;title=Csharp%2FCSharp_Tutorial%2FAttribute%2FConditional_Attribute"/>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/Attribute/Conditional_Attribute&amp;action=history"/>
		<updated>2026-04-30T04:03:20Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/Attribute/Conditional_Attribute&amp;diff=5155&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/Attribute/Conditional_Attribute&amp;diff=5155&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/Attribute/Conditional_Attribute&amp;diff=5156&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/Attribute/Conditional_Attribute&amp;diff=5156&amp;oldid=prev"/>
				<updated>2010-05-26T12:14:29Z</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;==Demonstrate the Conditional attribute==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;#define TRIAL &lt;br /&gt;
 &lt;br /&gt;
using System; &lt;br /&gt;
using System.Diagnostics; &lt;br /&gt;
 &lt;br /&gt;
class MainClass { &lt;br /&gt;
 &lt;br /&gt;
  [Conditional(&amp;quot;TRIAL&amp;quot;)]  &lt;br /&gt;
  void trial() { &lt;br /&gt;
    Console.WriteLine(&amp;quot;Trial version, not for distribution.&amp;quot;); &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  [Conditional(&amp;quot;RELEASE&amp;quot;)]  &lt;br /&gt;
  void release() { &lt;br /&gt;
    Console.WriteLine(&amp;quot;Final release version.&amp;quot;); &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  public static void Main() { &lt;br /&gt;
    MainClass t = new MainClass(); &lt;br /&gt;
 &lt;br /&gt;
    t.trial(); // call only if TRIAL is defined &lt;br /&gt;
    t.release(); // called only if RELEASE is defined &lt;br /&gt;
  } &lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;Trial version, not for distribution.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The Conditional Attribute==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;OL&amp;gt;&amp;lt;LI&amp;gt;The Conditional Attribute allows you to create conditional methods.&amp;lt;/LI&amp;gt;&amp;lt;LI&amp;gt;A conditional method is invoked only when a specific symbol has been defined via #define.&amp;lt;/LI&amp;gt;&amp;lt;LI&amp;gt;Otherwise, the method is bypassed.&amp;lt;/LI&amp;gt;&amp;lt;LI&amp;gt;A conditional method offers an alternative to conditional compilation using #if.&amp;lt;/LI&amp;gt;&amp;lt;LI&amp;gt;Conditional is another name for System.Diagnostics.ConditionalAttribute.&amp;lt;/LI&amp;gt;&amp;lt;LI&amp;gt;To use the Conditional attribute, you must include the System.Diagnostics namespace.&amp;lt;/LI&amp;gt;&amp;lt;/OL&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;Conditional methods have a few restrictions.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;OL&amp;gt;&amp;lt;LI&amp;gt;Conditional methods must return void.&amp;lt;/LI&amp;gt;&amp;lt;LI&amp;gt;Conditional methods must be members of a class, not an interface.&amp;lt;/LI&amp;gt;&amp;lt;LI&amp;gt;Conditional methods cannot be preceded with the override keyword.&amp;lt;/LI&amp;gt;&amp;lt;/OL&amp;gt;&lt;br /&gt;
10.3.Conditional Attribute&lt;br /&gt;
10.3.1.&lt;br /&gt;
The Conditional Attribute&lt;br /&gt;
10.3.2.&lt;br /&gt;
&amp;lt;A href=&amp;quot;/Tutorial/CSharp/0200__Attribute/DemonstratetheConditionalattribute.htm&amp;quot;&amp;gt;Demonstrate the Conditional attribute&amp;lt;/a&amp;gt;&lt;br /&gt;
10.3.3.&lt;br /&gt;
&amp;lt;A href=&amp;quot;/Tutorial/CSharp/0200__Attribute/TheConditionalattributesettinginCompileparameter.htm&amp;quot;&amp;gt;The Conditional attribute setting in Compile parameter&amp;lt;/a&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The Conditional attribute setting in Compile parameter==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;// csc /define:DEBUG MainClass.cs&lt;br /&gt;
using System;&lt;br /&gt;
using System.Diagnostics;  &lt;br /&gt;
public class MyClass {&lt;br /&gt;
  [Conditional(&amp;quot;DEBUG&amp;quot;)]&lt;br /&gt;
  public void OnlyWhenDebugIsDefined( ) {&lt;br /&gt;
    Console.WriteLine(&amp;quot;DEBUG is defined&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class MainClass {&lt;br /&gt;
  public static void Main( ) {&lt;br /&gt;
    MyClass f = new MyClass( );&lt;br /&gt;
    f.OnlyWhenDebugIsDefined( );&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>