-
Notifications
You must be signed in to change notification settings - Fork 479
Expand file tree
/
Copy pathImmutable_Simple_Options.cs
More file actions
147 lines (115 loc) · 5.26 KB
/
Immutable_Simple_Options.cs
File metadata and controls
147 lines (115 loc) · 5.26 KB
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
137
138
139
140
141
142
143
144
145
146
147
// Copyright 2005-2015 Giacomo Stelluti Scala & Contributors. All rights reserved. See License.md in the project root for license information.
using System.Collections.Generic;
namespace CommandLine.Tests.Fakes
{
public class Immutable_Simple_Options
{
private readonly string stringValue;
private readonly IEnumerable<int> intSequence;
private readonly bool boolValue;
private readonly long longValue;
public Immutable_Simple_Options(string stringValue, IEnumerable<int> intSequence, bool boolValue, long longValue)
{
this.stringValue = stringValue;
this.intSequence = intSequence;
this.boolValue = boolValue;
this.longValue = longValue;
}
[Option(HelpText = "Define a string value here.")]
public string StringValue { get { return stringValue; } }
[Option('i', Min = 3, Max = 4, HelpText = "Define a int sequence here.")]
public IEnumerable<int> IntSequence { get { return intSequence; } }
[Option('x', HelpText = "Define a boolean or switch value here.")]
public bool BoolValue { get { return boolValue; } }
[Value(0)]
public long LongValue { get { return longValue; } }
}
public class Immutable_Simple_Options_Invalid_Ctor_Args
{
private readonly string stringValue;
private readonly IEnumerable<int> intSequence;
private readonly bool boolValue;
private readonly long longValue;
public Immutable_Simple_Options_Invalid_Ctor_Args(string stringValue1, IEnumerable<int> intSequence2, bool boolValue, long longValue)
{
this.stringValue = stringValue1;
this.intSequence = intSequence2;
this.boolValue = boolValue;
this.longValue = longValue;
}
[Option(HelpText = "Define a string value here.")]
public string StringValue { get { return stringValue; } }
[Option('i', Min = 3, Max = 4, HelpText = "Define a int sequence here.")]
public IEnumerable<int> IntSequence { get { return intSequence; } }
[Option('x', HelpText = "Define a boolean or switch value here.")]
public bool BoolValue { get { return boolValue; } }
[Value(0)]
public long LongValue { get { return longValue; } }
}
public class Immutable_Simple_Options_Read_Only
{
public Immutable_Simple_Options_Read_Only(string stringValue, IEnumerable<int> intSequence, bool boolValue, long longValue)
{
StringValue = stringValue;
IntSequence = intSequence;
BoolValue = boolValue;
LongValue = longValue;
}
[Option(HelpText = "Define a string value here.")]
public string StringValue { get; }
[Option('i', Min = 3, Max = 4, HelpText = "Define a int sequence here.")]
public IEnumerable<int> IntSequence { get; }
[Option('x', HelpText = "Define a boolean or switch value here.")]
public bool BoolValue { get; }
[Value(0)]
public long LongValue { get; }
}
public class Immutable_Simple_Options_Private_Set
{
public Immutable_Simple_Options_Private_Set(string stringValue, IEnumerable<int> intSequence, bool boolValue, long longValue)
{
StringValue = stringValue;
IntSequence = intSequence;
BoolValue = boolValue;
LongValue = longValue;
}
[Option(HelpText = "Define a string value here.")]
public string StringValue { get; private set; }
[Option('i', Min = 3, Max = 4, HelpText = "Define a int sequence here.")]
public IEnumerable<int> IntSequence { get; private set; }
[Option('x', HelpText = "Define a boolean or switch value here.")]
public bool BoolValue { get; private set; }
[Value(0)]
public long LongValue { get; private set; }
}
#if NET5_0_OR_GREATER
public class Immutable_Simple_Options_Init
{
public Immutable_Simple_Options_Init(string stringValue, IEnumerable<int> intSequence, bool boolValue, long longValue)
{
StringValue = stringValue;
IntSequence = intSequence;
BoolValue = boolValue;
LongValue = longValue;
}
[Option(HelpText = "Define a string value here.")]
public string StringValue { get; init; }
[Option('i', Min = 3, Max = 4, HelpText = "Define a int sequence here.")]
public IEnumerable<int> IntSequence { get; init; }
[Option('x', HelpText = "Define a boolean or switch value here.")]
public bool BoolValue { get; init; }
[Value(0)]
public long LongValue { get; init; }
}
public record Immutable_Simple_Options_Record(
[property: Option(HelpText = "Define a string value here.")]
string StringValue,
[property: Option('i', Min = 3, Max = 4, HelpText = "Define a int sequence here.")]
IEnumerable<int> IntSequence,
[property: Option('x', HelpText = "Define a boolean or switch value here.")]
bool BoolValue,
[property: Value(0)]
long LongValue
);
#endif
}