Terraria
v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
KeyedStack.cs
Go to the documentation of this file.
1
using
System.Collections.Generic
;
2
3
namespace
System.Linq.Expressions.Compiler
;
4
5
internal
sealed
class
KeyedStack
<TKey, TValue>
where
TValue :
class
6
{
7
private
readonly
Dictionary<TKey, Stack<TValue>
>
_data
=
new
Dictionary<TKey, Stack<TValue>
>();
8
9
internal
void
Push
(TKey
key
, TValue
value
)
10
{
11
if
(!
_data
.
TryGetValue
(
key
,
out
var
value2
))
12
{
13
_data
.
Add
(
key
,
value2
=
new
Stack<TValue>
());
14
}
15
value2
.Push(
value
);
16
}
17
18
internal
TValue
TryPop
(TKey
key
)
19
{
20
if
(!
_data
.
TryGetValue
(
key
,
out
var
value
) || !
value
.TryPop(
out
var
result))
21
{
22
return
null
;
23
}
24
return
result;
25
}
26
}
System.Collections.Generic.Dictionary.TryGetValue
bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value)
Definition
Dictionary.cs:1419
System.Collections.Generic.Dictionary.Add
void Add(TKey key, TValue value)
Definition
Dictionary.cs:873
System.Collections.Generic.Dictionary
Definition
Dictionary.cs:14
System.Linq.Expressions.Compiler.KeyedStack.TryPop
TValue TryPop(TKey key)
Definition
KeyedStack.cs:18
System.Linq.Expressions.Compiler.KeyedStack._data
readonly Dictionary< TKey, Stack< TValue > > _data
Definition
KeyedStack.cs:7
System.Linq.Expressions.Compiler.KeyedStack.Push
void Push(TKey key, TValue value)
Definition
KeyedStack.cs:9
System.Linq.Expressions.Compiler.KeyedStack
Definition
KeyedStack.cs:6
System.Collections.Generic
Definition
IHashKeyCollection.cs:1
System.Linq.Expressions.Compiler
Definition
AnalyzedTree.cs:3
System.ExceptionArgument.value
@ value
System.ExceptionArgument.key
@ key
source
System.Linq.Expressions
System.Linq.Expressions.Compiler
KeyedStack.cs
Generated by
1.10.0