-
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathNewProperty.cs
50 lines (41 loc) · 1.09 KB
/
NewProperty.cs
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
namespace NewProperty
{
using System;
public abstract class BaseProperty
{
public object Value { get; set; }
public object ReplacedValue { get; set; }
}
public class DateTimeOffsetProperty : BaseProperty
{
public new DateTimeOffset Value
{
get => (DateTimeOffset)base.Value;
set => base.Value = value;
}
public new DateTimeOffset ReplacedValue { get; set; }
}
public class GenericProperty<T> : BaseProperty
{
public new T Value
{
get => (T)base.Value;
set => base.Value = value;
}
public new T ReplacedValue { get; set; }
}
public class BasePropertyUser
{
readonly BaseProperty property;
public BasePropertyUser(BaseProperty property)
{
this.property = property;
}
public void Foo()
{
property.Value = "test1";
property.ReplacedValue = "test2";
Console.WriteLine($"{property.Value} and {property.ReplacedValue}");
}
}
}