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 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
|
using System;
using System.Collections.Generic;
using System.Text;
using System.ServiceModel;
namespace MonoTests.Features.Contracts
{
// Define a service contract.
[ServiceContract (Namespace = "http://MonoTests.Features.Contracts")]
public interface IPrimitiveTesterContract
{
[OperationContract]
void DoNothing ();
[OperationContract]
int AddByte (byte n1, byte n2);
[OperationContract]
int AddSByte (sbyte n1, sbyte n2);
[OperationContract]
int AddShort (short n1, short n2);
[OperationContract]
int AddUShort (ushort n1, ushort n2);
[OperationContract]
int AddInt (int n1, int n2);
[OperationContract]
uint AddUInt (uint n1, uint n2);
[OperationContract]
long AddLong (long n1, long n2);
[OperationContract]
ulong AddULong (ulong n1, ulong n2);
[OperationContract]
double AddDouble (double n1, double n2);
[OperationContract]
float AddFloat (float n1, float n2);
[OperationContract]
char AddChar (char n1, char c2);
[OperationContract]
void AddByRef(double n1, double n2, out double n3, out double n4);
[OperationContract]
int? NullableInt (int? x);
[OperationContract]
float? NullableFloat (float? x);
[OperationContract]
TimeSpan AddTimeSpan (TimeSpan t1, TimeSpan t2);
[OperationContract]
byte [] AddByteArray (byte [] b1, byte [] b2);
}
public class PrimitiveTester : IPrimitiveTesterContract
{
public void DoNothing () {
}
public int AddByte (byte n1, byte n2) {
return (byte) n1 + n2;
}
public int AddSByte (sbyte n1, sbyte n2) {
return n1 + n2;
}
public int AddShort (short n1, short n2) {
return n1 + n2;
}
public int AddUShort (ushort n1, ushort n2) {
return n1 + n2;
}
public int AddInt (int n1, int n2) {
return n1 + n2;
}
public uint AddUInt (uint n1, uint n2) {
return n1 + n2;
}
public long AddLong (long n1, long n2) {
return n1 + n2;
}
public ulong AddULong (ulong n1, ulong n2) {
return n1 + n2;
}
public double AddDouble (double n1, double n2) {
return n1 + n2;
}
public float AddFloat (float n1, float n2) {
return n1 + n2;
}
public char AddChar (char n1, char n2) {
return (char)(n1 + n2);
}
public void AddByRef (double n1, double n2, out double n3, out double n4) {
n3 = n4 = n1 + n2;
}
public int? NullableInt(int?x) {
return x==null ? x : x+1;
}
public float? NullableFloat (float? x) {
return x == null ? x : x + 1;
}
public TimeSpan AddTimeSpan (TimeSpan t1, TimeSpan t2) {
return t1.Add (t2);
}
public byte [] AddByteArray (byte [] b1, byte [] b2) {
byte [] ret = new byte [b1.Length];
for (int i = 0; i < b1.Length; i++)
ret [i] = (byte) (b1 [i] + b2 [i]);
return ret;
}
}
}
|