Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 967d8ed

Browse files
committed
C#6-ify
1 parent 0997fe5 commit 967d8ed

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

src/ServiceStack.Text/Common/DeserializeListWithElements.cs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -199,23 +199,20 @@ public static ICollection<T> ParseGenericList(string value, Type createListType,
199199
public static class DeserializeList<T, TSerializer>
200200
where TSerializer : ITypeSerializer
201201
{
202-
private readonly static ParseStringDelegate CacheFn;
202+
private static readonly ParseStringDelegate CacheFn;
203203

204204
static DeserializeList()
205205
{
206206
CacheFn = GetParseFn();
207207
}
208208

209-
public static ParseStringDelegate Parse
210-
{
211-
get { return CacheFn; }
212-
}
209+
public static ParseStringDelegate Parse => CacheFn;
213210

214211
public static ParseStringDelegate GetParseFn()
215212
{
216213
var listInterface = typeof(T).GetTypeWithGenericInterfaceOf(typeof(IList<>));
217214
if (listInterface == null)
218-
throw new ArgumentException(string.Format("Type {0} is not of type IList<>", typeof(T).FullName));
215+
throw new ArgumentException($"Type {typeof(T).FullName} is not of type IList<>");
219216

220217
//optimized access for regularly used types
221218
if (typeof(T) == typeof(List<string>))
@@ -244,23 +241,20 @@ public static ParseStringDelegate GetParseFn()
244241
internal static class DeserializeEnumerable<T, TSerializer>
245242
where TSerializer : ITypeSerializer
246243
{
247-
private readonly static ParseStringDelegate CacheFn;
244+
private static readonly ParseStringDelegate CacheFn;
248245

249246
static DeserializeEnumerable()
250247
{
251248
CacheFn = GetParseFn();
252249
}
253250

254-
public static ParseStringDelegate Parse
255-
{
256-
get { return CacheFn; }
257-
}
251+
public static ParseStringDelegate Parse => CacheFn;
258252

259253
public static ParseStringDelegate GetParseFn()
260254
{
261255
var enumerableInterface = typeof(T).GetTypeWithGenericInterfaceOf(typeof(IEnumerable<>));
262256
if (enumerableInterface == null)
263-
throw new ArgumentException(string.Format("Type {0} is not of type IEnumerable<>", typeof(T).FullName));
257+
throw new ArgumentException($"Type {typeof(T).FullName} is not of type IEnumerable<>");
264258

265259
//optimized access for regularly used types
266260
if (typeof(T) == typeof(IEnumerable<string>))

src/ServiceStack.Text/LicenseUtils.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public static void AssertEvaluationLicense()
160160
"See https://servicestack.net to upgrade to a valid license.").Trace();
161161
}
162162

163-
private static readonly int[] revokedSubs = { 4018, 4019, 4041 };
163+
private static readonly int[] revokedSubs = { 4018, 4019, 4041, 4331 };
164164

165165
private static LicenseKey __activatedLicense;
166166
public static void RegisterLicense(string licenseKeyText)

0 commit comments

Comments
 (0)