Skip to content

Commit 6775d1f

Browse files
hyperia-forex: disable warning
1 parent 6dcb564 commit 6775d1f

File tree

2 files changed

+10
-90
lines changed

2 files changed

+10
-90
lines changed

exercises/concept/hyperia-forex/.meta/Exemplar.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
using System;
22
using System.Runtime.InteropServices;
33

4+
#pragma warning disable CS0660
5+
#pragma warning disable CS0661
6+
47
public struct CurrencyAmount
58
{
69
private decimal amount;
@@ -97,3 +100,6 @@ public static implicit operator decimal(CurrencyAmount @this)
97100
return @this.amount;
98101
}
99102
}
103+
104+
#pragma warning restore CS0660
105+
#pragma warning restore CS0661
Lines changed: 4 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
using System;
2-
using System.Runtime.InteropServices;
3-
4-
#pragma warning disable CS0660
5-
#pragma warning disable CS0661
6-
71
public struct CurrencyAmount
82
{
93
private decimal amount;
@@ -15,91 +9,11 @@ public CurrencyAmount(decimal amount, string currency)
159
this.currency = currency;
1610
}
1711

18-
public static bool operator ==(CurrencyAmount @this, CurrencyAmount other)
19-
{
20-
if (@this.currency != other.currency)
21-
{
22-
throw new ArgumentException();
23-
}
24-
25-
return @this.amount == other.amount;
26-
}
27-
28-
public static bool operator !=(CurrencyAmount @this, CurrencyAmount other)
29-
{
30-
if (@this.currency != other.currency)
31-
{
32-
throw new ArgumentException();
33-
}
34-
35-
return @this.amount != other.amount;
36-
}
37-
38-
public static bool operator >(CurrencyAmount @this, CurrencyAmount other)
39-
{
40-
if (@this.currency != other.currency)
41-
{
42-
throw new ArgumentException();
43-
}
44-
45-
return @this.amount > other.amount;
46-
}
47-
48-
public static bool operator <(CurrencyAmount @this, CurrencyAmount other)
49-
{
50-
if (@this.currency != other.currency)
51-
{
52-
throw new ArgumentException();
53-
}
54-
55-
return @this.amount < other.amount;
56-
}
57-
58-
public static CurrencyAmount operator +(CurrencyAmount @this, CurrencyAmount other)
59-
{
60-
if (@this.currency != other.currency)
61-
{
62-
throw new ArgumentException();
63-
}
64-
65-
return new CurrencyAmount(@this.amount + other.amount, @this.currency);
66-
}
67-
68-
public static CurrencyAmount operator -(CurrencyAmount @this, CurrencyAmount other)
69-
{
70-
if (@this.currency != other.currency)
71-
{
72-
throw new ArgumentException();
73-
}
74-
75-
return new CurrencyAmount(@this.amount - other.amount, @this.currency);
76-
}
12+
// TODO: implement equality operators
7713

78-
public static CurrencyAmount operator *(CurrencyAmount @this, decimal multiplier)
79-
{
80-
return new CurrencyAmount(@this.amount * multiplier, @this.currency);
81-
}
14+
// TODO: implement comparison operators
8215

83-
public static CurrencyAmount operator *(decimal multiplier, CurrencyAmount @this)
84-
{
85-
return new CurrencyAmount(@this.amount * multiplier, @this.currency);
86-
}
16+
// TODO: implement arithmetic operators
8717

88-
public static CurrencyAmount operator /(CurrencyAmount @this, decimal divisor)
89-
{
90-
return new CurrencyAmount(@this.amount / divisor, @this.currency);
91-
}
92-
93-
public static explicit operator double(CurrencyAmount @this)
94-
{
95-
return (double)@this.amount;
96-
}
97-
98-
public static implicit operator decimal(CurrencyAmount @this)
99-
{
100-
return @this.amount;
101-
}
18+
// TODO: implement type conversion operators
10219
}
103-
104-
#pragma warning restore CS0660
105-
#pragma warning restore CS0661

0 commit comments

Comments
 (0)