using System using System Collections Generic using System Linq using

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class MyClass
{
private int[,] m;
private int l;
private int k;
public MyClass(int[,] mm)
{
this.m = new int[mm.GetLength(0), mm.GetLength(1)];
this.m = mm;
this.l = mm.GetLength(0);
this.k = mm.GetLength(1);
}
public int L
{
get { return l; }
}
public int K
{
get { return k; }
}
public int this[int i, int j]
{
get { return m[i, j]; }
}
public MyClass geta()
{
if (k > 3)
{
for (int i = 0; i < l; i++)
{
int qwe = m[i, 1];
m[i, 1] = m[i, 3];
m[i, 3] = qwe;
}
}
return this;
}
}
class Program
{
static void Main(string[] args)
{
int[,] rty = new int[,] { {1,2,3,3,3},
{4,5,1,3,4},
{2,3,7,3,5},
{2,3,7,3,6}};
MyClass a = new MyClass(rty);
a.geta();
for (int i = 0; i < a.L; i++)
{
for (int j = 0; j < a.K; j++)
{
Console.Write("{0} ", a[i, j]);
}
Console.WriteLine();
}
}
}
}