Mirror Networking
Mirror.Extensions Class Reference

Static Public Member Functions

static int GetStableHashCode (this string text)
 
static void CopyTo< T > (this IEnumerable< T > source, List< T > destination)
 
static bool TryDequeue< T > (this Queue< T > source, out T element)
 

Detailed Description

Definition at line 7 of file Extensions.cs.

Member Function Documentation

◆ CopyTo< T >()

static void Mirror.Extensions.CopyTo< T > ( this IEnumerable< T >  source,
List< T >  destination 
)
static

Definition at line 36 of file Extensions.cs.

37 {
38 // foreach allocates. use AddRange.
39 destination.AddRange(source);
40 }

◆ GetStableHashCode()

static int Mirror.Extensions.GetStableHashCode ( this string  text)
static

Definition at line 11 of file Extensions.cs.

12 {
13 unchecked
14 {
15 int hash = 23;
16 foreach (char c in text)
17 hash = hash * 31 + c;
18 return hash;
19 }
20 }

◆ TryDequeue< T >()

static bool Mirror.Extensions.TryDequeue< T > ( this Queue< T >  source,
out T  element 
)
static

Definition at line 44 of file Extensions.cs.

45 {
46 if (source.Count > 0)
47 {
48 element = source.Dequeue();
49 return true;
50 }
51
52 element = default;
53 return false;
54 }