<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>How do I create a constant that is an array?</title><link>http://blogs.msdn.com/csharpfaq/archive/2004/12/03/274417.aspx</link><description>Strictly speaking you can't, since const can only be applied to a field or local whose value is known at compile time. In both the lines below, the right-hand is not a constant expression (not in C#). const int [] constIntArray = newint [] {2, 3, 4};</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: How do I create a constant that is an array?</title><link>http://blogs.msdn.com/csharpfaq/archive/2004/12/03/274417.aspx#274435</link><pubDate>Fri, 03 Dec 2004 18:08:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:274435</guid><dc:creator>Matthew W. Jackson</dc:creator><description>In practice, static readonly arrays are pretty useless.&lt;br&gt;&lt;br&gt;Sure, you cannot reassign the array itself, but you can replace individual values.  The &amp;quot;readonly&amp;quot; just makes you think it cannot be changed, which is bad because you end up with mistakes like System.IO.Path.InvalidPathChars.&lt;br&gt;&lt;br&gt;Since some malicious code may change an InvalidPathChars entry, it is useless for validation.</description></item><item><title>re: How do I create a constant that is an array?</title><link>http://blogs.msdn.com/csharpfaq/archive/2004/12/03/274417.aspx#331125</link><pubDate>Thu, 23 Dec 2004 08:46:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:331125</guid><dc:creator>JC#</dc:creator><description>PERFECT!</description></item><item><title>Comment puis-je cr</title><link>http://blogs.msdn.com/csharpfaq/archive/2004/12/03/274417.aspx#347182</link><pubDate>Thu, 06 Jan 2005 01:32:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:347182</guid><dc:creator>FAQ C#</dc:creator><description /></item><item><title>Comment puis-je cr</title><link>http://blogs.msdn.com/csharpfaq/archive/2004/12/03/274417.aspx#455018</link><pubDate>Tue, 23 Aug 2005 12:14:21 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:455018</guid><dc:creator>FAQ C# (par Yannick Lejeune)</dc:creator><description /></item><item><title>Comment puis-je cr</title><link>http://blogs.msdn.com/csharpfaq/archive/2004/12/03/274417.aspx#455021</link><pubDate>Tue, 23 Aug 2005 12:17:11 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:455021</guid><dc:creator>FAQ C# (par Yannick Lejeune)</dc:creator><description /></item><item><title>re: How do I create a constant that is an array?</title><link>http://blogs.msdn.com/csharpfaq/archive/2004/12/03/274417.aspx#9917419</link><pubDate>Wed, 04 Nov 2009 17:20:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9917419</guid><dc:creator>Igor</dc:creator><description>&lt;p&gt;The following code compiles with no problem:&lt;/p&gt;
&lt;p&gt;const int[] constArray = null;&lt;/p&gt;
&lt;p&gt;constArray[0] = 1;&lt;/p&gt;
</description></item></channel></rss>