Visual Basic (Declaration) | |
---|---|
Public Function Invert( _ ByVal ceiling As Integer _ ) As OrdinalList |
C# | |
---|---|
public OrdinalList Invert( int ceiling ) |
Parameters
- ceiling
Library/Library.Test/TestOrdinalList.cs
C# | Copy Code |
---|---|
OrdinalList lista = new OrdinalList(new int[] {0, 2, 4, 6, 8, 10, 12}); OrdinalList listb = new OrdinalList(new int[] {1, 3, 5, 7, 9, 11, 13}); OrdinalList invta = lista.Invert(13); string invtatext = "", listbtext = ""; foreach (int i in invta) invtatext += "," + i; foreach (int i in listb) listbtext += "," + i; Assert.AreEqual(listbtext, invtatext); lista = new OrdinalList(new int[] { 0 }); listb = new OrdinalList(new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 }); invta = lista.Invert(13); invtatext = ""; listbtext = ""; foreach (int i in invta) invtatext += "," + i; foreach (int i in listb) listbtext += "," + i; Assert.AreEqual(listbtext, invtatext); lista = new OrdinalList(new int[] { 0, 1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 13 }); listb = new OrdinalList(new int[] { 3 }); invta = lista.Invert(4); invtatext = ""; listbtext = ""; foreach (int i in invta) invtatext += "," + i; foreach (int i in listb) listbtext += "," + i; Assert.AreEqual(listbtext, invtatext); |
VB.NET | Copy Code |
---|---|
Dim lista As New OrdinalList(New Integer() {0, 2, 4, 6, 8, 10, _ 12}) Dim listb As New OrdinalList(New Integer() {1, 3, 5, 7, 9, 11, _ 13}) Dim invta As OrdinalList = lista.Invert(13) Dim invtatext As String = "", listbtext As String = "" For Each i As Integer In invta invtatext += "," + i Next For Each i As Integer In listb listbtext += "," + i Next Assert.AreEqual(listbtext, invtatext) lista = New OrdinalList(New Integer() {0}) listb = New OrdinalList(New Integer() {1, 2, 3, 4, 5, 6, _ 7, 8, 9, 10, 11, 12, _ 13}) invta = lista.Invert(13) invtatext = "" listbtext = "" For Each i As Integer In invta invtatext += "," + i Next For Each i As Integer In listb listbtext += "," + i Next Assert.AreEqual(listbtext, invtatext) lista = New OrdinalList(New Integer() {0, 1, 2, 4, 5, 6, _ 7, 8, 9, 10, 11, 13}) listb = New OrdinalList(New Integer() {3}) invta = lista.Invert(4) invtatext = "" listbtext = "" For Each i As Integer In invta invtatext += "," + i Next For Each i As Integer In listb listbtext += "," + i Next Assert.AreEqual(listbtext, invtatext) |
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7
Reference
OrdinalList ClassOrdinalList Members