This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public string EnumTable<T>() where T: Enum | |
| { | |
| var DeclareTable = $"DECLARE @{typeof(T).Name} TABLE ( Id INT, Value NVARCHAR(50) )\n"; | |
| var insert = $"INSERT INTO @{typeof(T).Name} (Id, Value)\nVALUES"; | |
| var values = Enum.GetValues(typeof(T)) | |
| .Cast<T>() | |
| .Select(v => $"({Convert.ToInt32(v)}, '{v.ToString()}')"); | |
| return DeclareTable + insert + string.Join(",\r\n", values); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <TestMethod()> | |
| Public Sub TestPushTooMany() | |
| Dim stack As Stack(Of Double) = New Stack(Of Double)(1) | |
| Try | |
| stack.Push(123.456) | |
| stack.Push(89.123) | |
| Assert.Fail("Should not reach this point") | |
| Catch ex As Exception |