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

	<entry>
		<id>http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/Data_Structure/Array_object&amp;diff=5523&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/Data_Structure/Array_object&amp;diff=5523&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/Data_Structure/Array_object&amp;diff=5524&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/Data_Structure/Array_object&amp;diff=5524&amp;oldid=prev"/>
				<updated>2010-05-26T12:15:49Z</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;==Arrays of Objects==&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;
class Employee&lt;br /&gt;
{&lt;br /&gt;
    public Employee(string name, float billingRate)&lt;br /&gt;
    {&lt;br /&gt;
        this.name = name;&lt;br /&gt;
        this.billingRate = billingRate;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public float CalculateCharge(float hours)&lt;br /&gt;
    {&lt;br /&gt;
        return(hours * billingRate);&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public string TypeName()&lt;br /&gt;
    {&lt;br /&gt;
        return(&amp;quot;Employee&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    private string name;&lt;br /&gt;
    protected float billingRate;&lt;br /&gt;
}&lt;br /&gt;
class Manager: Employee&lt;br /&gt;
{&lt;br /&gt;
    public Manager(string name, float billingRate) :&lt;br /&gt;
    base(name, billingRate)&lt;br /&gt;
    {&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public new float CalculateCharge(float hours)&lt;br /&gt;
    {&lt;br /&gt;
        if (hours &amp;lt; 1.0F)&lt;br /&gt;
        hours = 1.0F;        // minimum charge.&lt;br /&gt;
        return(hours * billingRate);&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public new string TypeName()&lt;br /&gt;
    {&lt;br /&gt;
        return(&amp;quot;Civil Employee&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
class MainClass&lt;br /&gt;
{&lt;br /&gt;
    public static void Main()&lt;br /&gt;
    {&lt;br /&gt;
        // create an array of Employees&lt;br /&gt;
        Employee[]    earray = new Employee[2];&lt;br /&gt;
        earray[0] = new Employee(&amp;quot;A&amp;quot;, 15.50F);&lt;br /&gt;
        earray[1] = new Manager(&amp;quot;B&amp;quot;, 40F);&lt;br /&gt;
        &lt;br /&gt;
        Console.WriteLine(&amp;quot;{0} charge = {1}&amp;quot;,&lt;br /&gt;
        earray[0].TypeName(),&lt;br /&gt;
        earray[0].CalculateCharge(2F));&lt;br /&gt;
        Console.WriteLine(&amp;quot;{0} charge = {1}&amp;quot;,&lt;br /&gt;
        earray[1].TypeName(),&lt;br /&gt;
        earray[1].CalculateCharge(0.75F));&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;Employee charge = 31&lt;br /&gt;
Employee charge = 30&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==A two dimensional array of objects==&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;
public class Employee&lt;br /&gt;
{&lt;br /&gt;
  public string name;&lt;br /&gt;
  public int no;&lt;br /&gt;
  public Employee(string name,int no)&lt;br /&gt;
  {&lt;br /&gt;
    this.name = name;&lt;br /&gt;
    this.no = no;&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class MainClass&lt;br /&gt;
{&lt;br /&gt;
  public static void Main()&lt;br /&gt;
  {&lt;br /&gt;
    Employee[,,] empArray = new Employee[10, 5, 3];&lt;br /&gt;
    empArray[1, 3, 2] = new Employee(&amp;quot;S&amp;quot;, 3);&lt;br /&gt;
    empArray[4, 1, 2] = new Employee(&amp;quot;A&amp;quot;, 9);&lt;br /&gt;
    Console.WriteLine(&amp;quot;empArray.Rank (number of dimensions) = &amp;quot; + empArray.Rank);&lt;br /&gt;
    Console.WriteLine(&amp;quot;empArray.Length (number of elements) = &amp;quot; + empArray.Length);&lt;br /&gt;
    for (int x = 0; x &amp;lt; empArray.GetLength(0); x++)&lt;br /&gt;
    {&lt;br /&gt;
      for (int y = 0; y &amp;lt; empArray.GetLength(1); y++)&lt;br /&gt;
      {&lt;br /&gt;
        for (int z = 0; z &amp;lt; empArray.GetLength(2); z++)&lt;br /&gt;
        {&lt;br /&gt;
          if (empArray[x, y, z] != null)&lt;br /&gt;
          {&lt;br /&gt;
            Console.WriteLine(&amp;quot;empArray[&amp;quot; + x + &amp;quot;, &amp;quot; + y + &amp;quot;, &amp;quot; + z +&amp;quot;].name = &amp;quot; + empArray[x, y, z].name);&lt;br /&gt;
            Console.WriteLine(&amp;quot;empArray[&amp;quot; + x + &amp;quot;, &amp;quot; + y + &amp;quot;, &amp;quot; + z +&amp;quot;].no = &amp;quot; + empArray[x, y, z].no);&lt;br /&gt;
          }&lt;br /&gt;
        }&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;empArray.Rank (number of dimensions) = 3&lt;br /&gt;
empArray.Length (number of elements) = 150&lt;br /&gt;
empArray[1, 3, 2].name = S&lt;br /&gt;
empArray[1, 3, 2].no = 3&lt;br /&gt;
empArray[4, 1, 2].name = A&lt;br /&gt;
empArray[4, 1, 2].no = 9&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==string arrays==&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;
class MainClass&lt;br /&gt;
{&lt;br /&gt;
  public static void Main()&lt;br /&gt;
  {&lt;br /&gt;
   &lt;br /&gt;
    string[] stringArray = new string[2];&lt;br /&gt;
    Console.WriteLine(&amp;quot;stringArray[0] = &amp;quot; + stringArray[0]);&lt;br /&gt;
    stringArray[0] = &amp;quot;Hello&amp;quot;;&lt;br /&gt;
    stringArray[1] = &amp;quot;World&amp;quot;;&lt;br /&gt;
    foreach (string myString in stringArray)&lt;br /&gt;
    {&lt;br /&gt;
      Console.WriteLine(&amp;quot;myString = &amp;quot; + myString);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;stringArray[0] =&lt;br /&gt;
myString = Hello&lt;br /&gt;
myString = World&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Use object to create a generic array.==&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;
 &lt;br /&gt;
class MainClass {   &lt;br /&gt;
  public static void Main() {   &lt;br /&gt;
    object[] ga = new object[10]; &lt;br /&gt;
  &lt;br /&gt;
    // store ints &lt;br /&gt;
    for(int i=0; i &amp;lt; 3; i++) &lt;br /&gt;
      ga[i] = i; &lt;br /&gt;
  &lt;br /&gt;
    // store doubles &lt;br /&gt;
    for(int i=3; i &amp;lt; 6; i++) &lt;br /&gt;
      ga[i] = (double) i / 2;  &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
    // store two strings, a bool, and a char &lt;br /&gt;
    ga[6] = &amp;quot;String&amp;quot;; &lt;br /&gt;
    ga[7] = true; &lt;br /&gt;
    ga[8] = &amp;quot;X&amp;quot;; &lt;br /&gt;
    ga[9] = &amp;quot;asdf&amp;quot;; &lt;br /&gt;
 &lt;br /&gt;
    for(int i = 0; i &amp;lt; ga.Length; i++) &lt;br /&gt;
      Console.WriteLine(&amp;quot;ga[&amp;quot; + i + &amp;quot;]: &amp;quot; + ga[i] + &amp;quot; &amp;quot;); &lt;br /&gt;
 &lt;br /&gt;
  }  &lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;ga[0]: 0&lt;br /&gt;
ga[1]: 1&lt;br /&gt;
ga[2]: 2&lt;br /&gt;
ga[3]: 1.5&lt;br /&gt;
ga[4]: 2&lt;br /&gt;
ga[5]: 2.5&lt;br /&gt;
ga[6]: String&lt;br /&gt;
ga[7]: True&lt;br /&gt;
ga[8]: X&lt;br /&gt;
ga[9]: asdf&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Use the Sort() method to sort the elements in a char array==&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;
class MainClass&lt;br /&gt;
{&lt;br /&gt;
  public static void Main()&lt;br /&gt;
  {&lt;br /&gt;
    char[] charArray = {&amp;quot;w&amp;quot;, &amp;quot;e&amp;quot;, &amp;quot;l&amp;quot;, &amp;quot;c&amp;quot;, &amp;quot;o&amp;quot;, &amp;quot;m&amp;quot;, &amp;quot;e&amp;quot;};&lt;br /&gt;
    Array.Sort(charArray);  // sort the elements&lt;br /&gt;
    Console.WriteLine(&amp;quot;Sorted charArray:&amp;quot;);&lt;br /&gt;
    for (int i = 0; i &amp;lt; charArray.Length; i++)&lt;br /&gt;
    {&lt;br /&gt;
      Console.WriteLine(&amp;quot;charArray[&amp;quot; + i + &amp;quot;] = &amp;quot; +&lt;br /&gt;
        charArray[i]);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;Sorted charArray:&lt;br /&gt;
charArray[0] = c&lt;br /&gt;
charArray[1] = e&lt;br /&gt;
charArray[2] = e&lt;br /&gt;
charArray[3] = l&lt;br /&gt;
charArray[4] = m&lt;br /&gt;
charArray[5] = o&lt;br /&gt;
charArray[6] = w&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>