Documentation for the Unity C# Library
Loading...
Searching...
No Matches
DelimiterExtensions.cs
Go to the documentation of this file.
1using System;
2using System.ComponentModel;
3
4namespace yutokun
5{
6 public static class DelimiterExtensions
7 {
8 public static char ToChar(this Delimiter delimiter)
9 {
10 // C# 7.3: Unity 2018.2 - 2020.1 Compatible
11 switch (delimiter)
12 {
13 case Delimiter.Auto:
14 throw new InvalidEnumArgumentException("Could not return char of Delimiter.Auto.");
15 case Delimiter.Comma:
16 return ',';
17 case Delimiter.Tab:
18 return '\t';
19 default:
20 throw new ArgumentOutOfRangeException(nameof(delimiter), delimiter, null);
21 }
22 }
23 }
24}
static char ToChar(this Delimiter delimiter)