NativeDictionary<TKey, TValue> 结构
Native dictionary
命名空间: NativeCollections
程序集: Fantasy.Net.dll
语法
[StructLayout(LayoutKind.Sequential)]
public readonly struct NativeDictionary<TKey, TValue> : IDisposable, IEquatable<NativeDictionary<TKey, TValue>> where TKey : unmanaged, IEquatable<TKey> where TValue : unmanaged
类型参数
名称 | 描述 |
---|---|
TKey | Type |
TValue | Type |
构造函数
| 编辑本文 查看源代码NativeDictionary(int)
Structure
声明
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public NativeDictionary(int capacity)
参数
类型 | 名称 | 描述 |
---|---|---|
int | capacity | Capacity |
属性
| 编辑本文 查看源代码Count
Count
声明
public int Count { get; }
属性值
类型 | 描述 |
---|---|
int |
Empty
Empty
声明
public static NativeDictionary<TKey, TValue> Empty { get; }
属性值
类型 | 描述 |
---|---|
NativeDictionary<TKey, TValue> |
IsCreated
Is created
声明
public bool IsCreated { get; }
属性值
类型 | 描述 |
---|---|
bool |
IsEmpty
Is empty
声明
public bool IsEmpty { get; }
属性值
类型 | 描述 |
---|---|
bool |
this[TKey]
Get or set value
声明
public TValue this[in TKey key] { get; set; }
参数
类型 | 名称 | 描述 |
---|---|---|
TKey | key | Key |
属性值
类型 | 描述 |
---|---|
TValue |
Keys
Keys
声明
public NativeDictionary<TKey, TValue>.KeyCollection Keys { get; }
属性值
类型 | 描述 |
---|---|
NativeDictionary<TKey, TValue>.KeyCollection |
Values
Values
声明
public NativeDictionary<TKey, TValue>.ValueCollection Values { get; }
属性值
类型 | 描述 |
---|---|
NativeDictionary<TKey, TValue>.ValueCollection |
方法
| 编辑本文 查看源代码Add(in TKey, in TValue)
Add
声明
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Add(in TKey key, in TValue value)
参数
类型 | 名称 | 描述 |
---|---|---|
TKey | key | Key |
TValue | value | Value |
Clear()
Clear
声明
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Clear()
ContainsKey(in TKey)
Contains key
声明
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool ContainsKey(in TKey key)
参数
类型 | 名称 | 描述 |
---|---|---|
TKey | key | Key |
返回
类型 | 描述 |
---|---|
bool | Contains key |
Dispose()
Dispose
声明
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Dispose()
EnsureCapacity(int)
Ensure capacity
声明
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int EnsureCapacity(int capacity)
参数
类型 | 名称 | 描述 |
---|---|---|
int | capacity | Capacity |
返回
类型 | 描述 |
---|---|
int | New capacity |
Equals(NativeDictionary<TKey, TValue>)
Equals
声明
public bool Equals(NativeDictionary<TKey, TValue> other)
参数
类型 | 名称 | 描述 |
---|---|---|
NativeDictionary<TKey, TValue> | other | Other |
返回
类型 | 描述 |
---|---|
bool | Equals |
Equals(object?)
Equals
声明
public override bool Equals(object? obj)
参数
类型 | 名称 | 描述 |
---|---|---|
object | obj | object |
返回
类型 | 描述 |
---|---|
bool | Equals |
重写
| 编辑本文 查看源代码GetEnumerator()
Get enumerator
声明
public NativeDictionary<TKey, TValue>.Enumerator GetEnumerator()
返回
类型 | 描述 |
---|---|
NativeDictionary<TKey, TValue>.Enumerator | Enumerator |
GetHashCode()
Get hashCode
声明
public override int GetHashCode()
返回
类型 | 描述 |
---|---|
int | HashCode |
重写
| 编辑本文 查看源代码Remove(in TKey)
Remove
声明
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Remove(in TKey key)
参数
类型 | 名称 | 描述 |
---|---|---|
TKey | key | Key |
返回
类型 | 描述 |
---|---|
bool | Removed |
Remove(in TKey, out TValue)
Remove
声明
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Remove(in TKey key, out TValue value)
参数
类型 | 名称 | 描述 |
---|---|---|
TKey | key | Key |
TValue | value | Value |
返回
类型 | 描述 |
---|---|
bool | Removed |
ToString()
To string
声明
public override string ToString()
返回
类型 | 描述 |
---|---|
string | String |
重写
| 编辑本文 查看源代码TrimExcess()
Trim excess
声明
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int TrimExcess()
返回
类型 | 描述 |
---|---|
int | New capacity |
TrimExcess(int)
Trim excess
声明
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int TrimExcess(int capacity)
参数
类型 | 名称 | 描述 |
---|---|---|
int | capacity | Capacity |
返回
类型 | 描述 |
---|---|
int | New capacity |
TryAdd(in TKey, in TValue)
Try add
声明
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool TryAdd(in TKey key, in TValue value)
参数
类型 | 名称 | 描述 |
---|---|---|
TKey | key | Key |
TValue | value | Value |
返回
类型 | 描述 |
---|---|
bool | Added |
TryGetValue(in TKey, out TValue)
Try to get the value
声明
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool TryGetValue(in TKey key, out TValue value)
参数
类型 | 名称 | 描述 |
---|---|---|
TKey | key | Key |
TValue | value | Value |
返回
类型 | 描述 |
---|---|
bool | Got |
运算符
| 编辑本文 查看源代码operator ==(NativeDictionary<TKey, TValue>, NativeDictionary<TKey, TValue>)
Equals
声明
public static bool operator ==(NativeDictionary<TKey, TValue> left, NativeDictionary<TKey, TValue> right)
参数
类型 | 名称 | 描述 |
---|---|---|
NativeDictionary<TKey, TValue> | left | Left |
NativeDictionary<TKey, TValue> | right | Right |
返回
类型 | 描述 |
---|---|
bool | Equals |
operator !=(NativeDictionary<TKey, TValue>, NativeDictionary<TKey, TValue>)
Not equals
声明
public static bool operator !=(NativeDictionary<TKey, TValue> left, NativeDictionary<TKey, TValue> right)
参数
类型 | 名称 | 描述 |
---|---|---|
NativeDictionary<TKey, TValue> | left | Left |
NativeDictionary<TKey, TValue> | right | Right |
返回
类型 | 描述 |
---|---|
bool | Not equals |