1
ļ»æ// Copyright (c) AlphaSierraPapa for the SharpDevelop Team
3
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
4
// software and associated documentation files (the "Software"), to deal in the Software
5
// without restriction, including without limitation the rights to use, copy, modify, merge,
6
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
7
// to whom the Software is furnished to do so, subject to the following conditions:
9
// The above copyright notice and this permission notice shall be included in all copies or
10
// substantial portions of the Software.
12
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
13
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
14
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
15
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
16
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
17
// DEALINGS IN THE SOFTWARE.
21
public class IncrementDecrement
32
public class MutableClass
42
public uint this[string name]
54
private IncrementDecrement.MyEnum enumField;
55
public static int StaticField;
57
public static int StaticProperty
63
private IncrementDecrement.MutableClass M()
65
return new IncrementDecrement.MutableClass();
68
private int[,] Array()
73
private unsafe int* GetPointer()
78
public int PreIncrementInAddition(int i, int j)
83
public int PreIncrementArrayElement(int[] array, int pos)
88
public int PreIncrementInstanceField()
90
return ++this.M().Field;
93
public int PreIncrementInstanceField2(IncrementDecrement.MutableClass m)
98
public int PreIncrementInstanceProperty()
100
return ++this.M().Property;
103
public int PreIncrementStaticField()
105
return ++IncrementDecrement.StaticField;
108
public int PreIncrementStaticProperty()
110
return ++IncrementDecrement.StaticProperty;
113
// public uint PreIncrementIndexer(string name)
115
// return ++this.M()[name];
118
public int PreIncrementByRef(ref int i)
123
public unsafe int PreIncrementByPointer()
125
return ++(*this.GetPointer());
128
public int PreIncrement2DArray()
130
return ++this.Array()[1, 2];
133
public int CompoundAssignInstanceField()
135
return this.M().Field *= 10;
138
public int CompoundAssignInstanceProperty()
140
return this.M().Property *= 10;
143
public int CompoundAssignStaticField()
145
return IncrementDecrement.StaticField ^= 100;
148
public int CompoundAssignStaticProperty()
150
return IncrementDecrement.StaticProperty &= 10;
153
public int CompoundAssignArrayElement1(int[] array, int pos)
155
return array[pos] *= 10;
158
public int CompoundAssignArrayElement2(int[] array)
160
return array[Environment.TickCount] *= 10;
163
// public uint CompoundAssignIndexer(string name)
165
// return this.M()[name] -= 2;
168
public int CompoundAssignIncrement2DArray()
170
return this.Array()[1, 2] %= 10;
173
public int CompoundAssignByRef(ref int i)
178
public unsafe double CompoundAssignByPointer(double* ptr)
183
public void CompoundAssignEnum()
185
this.enumField |= IncrementDecrement.MyEnum.Two;
186
this.enumField &= ~IncrementDecrement.MyEnum.Four;
189
public int PostIncrementInAddition(int i, int j)
194
public void PostIncrementInlineLocalVariable(Func<int, int> f)
200
public int PostIncrementArrayElement(int[] array, int pos)
205
public int PostIncrementStaticField()
207
return IncrementDecrement.StaticField++;
210
public int PostIncrementStaticProperty()
212
return IncrementDecrement.StaticProperty++;
215
public int PostIncrementInstanceField(IncrementDecrement.MutableClass m)
220
// public uint PostIncrementIndexer(string name)
222
// return this.M()[name]++;
225
// public unsafe int PostIncrementOfPointer(int* ptr)
230
public int PostIncrementInstanceField()
232
return this.M().Field--;
235
public int PostIncrementInstanceProperty()
237
return this.M().Property--;
240
public int PostIncrement2DArray()
242
return this.Array()[IncrementDecrement.StaticField, IncrementDecrement.StaticProperty]++;
245
public int PostIncrementByRef(ref int i)
250
public unsafe int PostIncrementByPointer()
252
return (*this.GetPointer())++;