<?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%2FC_Sharp%2FLanguage_Basics%2Fstackalloc</id>
		<title>Csharp/C Sharp/Language Basics/stackalloc - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://nfex.ru/index.php?action=history&amp;feed=atom&amp;title=Csharp%2FC_Sharp%2FLanguage_Basics%2Fstackalloc"/>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/C_Sharp/Language_Basics/stackalloc&amp;action=history"/>
		<updated>2026-04-29T17:29:16Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://nfex.ru/index.php?title=Csharp/C_Sharp/Language_Basics/stackalloc&amp;diff=712&amp;oldid=prev</id>
		<title> в 15:31, 26 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/C_Sharp/Language_Basics/stackalloc&amp;diff=712&amp;oldid=prev"/>
				<updated>2010-05-26T15:31:18Z</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/C_Sharp/Language_Basics/stackalloc&amp;diff=713&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/C_Sharp/Language_Basics/stackalloc&amp;diff=713&amp;oldid=prev"/>
				<updated>2010-05-26T11:39:36Z</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;==allocates 26 characters on the stack the for loop assigns alphabetic characters to each element==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt; &lt;br /&gt;
using System;&lt;br /&gt;
public unsafe class Starter {&lt;br /&gt;
    public static void Main() {&lt;br /&gt;
        char* pChar = stackalloc char[26];&lt;br /&gt;
        char* _pChar = pChar;&lt;br /&gt;
        for (int count = 0; count &amp;lt; 26; ++count) {&lt;br /&gt;
            (*_pChar) = (char)(((int)(&amp;quot;A&amp;quot;)) + count);&lt;br /&gt;
            ++_pChar;&lt;br /&gt;
        }&lt;br /&gt;
        for (int count = 0; count &amp;lt; 26; ++count) {&lt;br /&gt;
            Console.Write(pChar[count]);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Invalid Cast Exceptions with Implicit Operators==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt; &lt;br /&gt;
&lt;br /&gt;
public class TestClass&lt;br /&gt;
{&lt;br /&gt;
    private MainClass MyMainClassObject;&lt;br /&gt;
   &lt;br /&gt;
    public TestClass()&lt;br /&gt;
    {&lt;br /&gt;
        MyMainClassObject = new MainClass();&lt;br /&gt;
    }&lt;br /&gt;
   &lt;br /&gt;
    public static implicit operator MainClass(TestClass Source)&lt;br /&gt;
    {&lt;br /&gt;
        return Source.MyMainClassObject;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
public class MainClass&lt;br /&gt;
{&lt;br /&gt;
    public static void Main()&lt;br /&gt;
    {&lt;br /&gt;
        object MyObject;&lt;br /&gt;
        MainClass MyMainClassObject;&lt;br /&gt;
   &lt;br /&gt;
        MyObject = new TestClass();&lt;br /&gt;
        MyMainClassObject = (MainClass)MyObject;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==stackalloc Demo==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt; &lt;br /&gt;
using System;&lt;br /&gt;
class MainEntryPoint {&lt;br /&gt;
    static unsafe void Main() {&lt;br /&gt;
        Console.Write(&amp;quot;How big an array do you want? \n&amp;gt; &amp;quot;);&lt;br /&gt;
        string userInput = Console.ReadLine();&lt;br /&gt;
        uint size = uint.Parse(userInput);&lt;br /&gt;
        long* pArray = stackalloc long[(int)size];&lt;br /&gt;
        for (int i = 0; i &amp;lt; size; i++)&lt;br /&gt;
            pArray[i] = i * i;&lt;br /&gt;
        for (int i = 0; i &amp;lt; size; i++)&lt;br /&gt;
            Console.WriteLine(&amp;quot;Element {0} = {1}&amp;quot;, i, *(pArray + i));&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Use stackalloc to allocate memory for integer array==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt; &lt;br /&gt;
using System;&lt;br /&gt;
class TestStackallocApp&lt;br /&gt;
{&lt;br /&gt;
    unsafe public static void Foo(int* pa)&lt;br /&gt;
    {&lt;br /&gt;
        for (int* ip = pa; ip &amp;lt; (pa+5); ip++)&lt;br /&gt;
        {&lt;br /&gt;
            Console.WriteLine(&amp;quot;value {0} at address: {1}&amp;quot;, *ip, (int)ip);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
   &lt;br /&gt;
    static void Main(string[] args)&lt;br /&gt;
    {&lt;br /&gt;
        unsafe&lt;br /&gt;
        {&lt;br /&gt;
            int* pa = stackalloc int[5];&lt;br /&gt;
            pa[0] = 12;&lt;br /&gt;
            pa[1] = 34;&lt;br /&gt;
            pa[2] = 56;&lt;br /&gt;
            pa[3] = 78;&lt;br /&gt;
            pa[4] = 90;&lt;br /&gt;
            Foo(pa);&lt;br /&gt;
        }&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>