Skip to content

List All Tax Names

Enter Code

Enter the following code in a file named ‘List.cs’:

using System;
using System.Collections;
using TaxControls;
class Test{
public static void Main(){
try {
CTaxControl tc = new CTaxControl();
tc.DataFilename = "demo.tax";
Taxes txs = tc.Taxes
IEnumerator inr = txs.GetEnumerator();
while(inr.MoveNext()){
Tax t = (Tax) inr.Current;
Console.WriteLine(t.Name);
}
} catch (TaxControlException e) {
Console.WriteLine(e.Message);
}
}
}

Compile

Compile the code at the command prompt by executing the following:

Terminal window
csc /reference:TaxControls.dll List.cs

Run

Run the code by typing:

Terminal window
List