Enhanced C#
Language of your choice: library documentation
Public static fields | Properties | Static Public Member Functions | List of all members
Loyc.Collections.CG Class Reference

Contains global functions of Loyc.Collections that don't belong in any specific class. More...


Source file:

Remarks

Contains global functions of Loyc.Collections that don't belong in any specific class.

Public static fields

static SimpleCache< object > _objectCache
 

Properties

static SimpleCache< object >?? ObjectCache [get]
 Gets the cache used by Cache(object). More...
 

Static Public Member Functions

static object Cache (object o)
 Passes the object through a thread-static instance of SimpleCache<o>. More...
 
static object Cache (int num)
 If the specified number is in the range -3 to 9 inclusive, an equivalent preallocated boxed integer is returned, otherwise the other overload, Cache(object), is invoked to handle the request. More...
 
static object Cache (char o)
 Special overload to avoid treating argument as int32 in C#. More...
 
static object Cache (byte o)
 Special overload to avoid treating argument as int32 in C#. More...
 
static object Cache (sbyte o)
 Special overload to avoid treating argument as int32 in C#. More...
 
static object Cache (short o)
 Special overload to avoid treating argument as int32 in C#. More...
 
static object Cache (ushort o)
 Special overload to avoid treating argument as int32 in C#. More...
 
static object Cache (bool value)
 Returns G.BoxedTrue or G.BoxedFalse depending on the parameter. More...
 

Member Function Documentation

◆ Cache() [1/8]

static object Loyc.Collections.CG.Cache ( bool  value)
inlinestatic

Returns G.BoxedTrue or G.BoxedFalse depending on the parameter.

References Loyc.G.BoxedFalse, and Loyc.G.BoxedTrue.

◆ Cache() [2/8]

static object Loyc.Collections.CG.Cache ( byte  o)
inlinestatic

Special overload to avoid treating argument as int32 in C#.

References Loyc.Collections.CG.Cache().

Referenced by Loyc.Collections.CG.Cache().

◆ Cache() [3/8]

static object Loyc.Collections.CG.Cache ( char  o)
inlinestatic

Special overload to avoid treating argument as int32 in C#.

References Loyc.Collections.CG.Cache().

Referenced by Loyc.Collections.CG.Cache().

◆ Cache() [4/8]

static object Loyc.Collections.CG.Cache ( int  num)
inlinestatic

If the specified number is in the range -3 to 9 inclusive, an equivalent preallocated boxed integer is returned, otherwise the other overload, Cache(object), is invoked to handle the request.

Parameters
numAn integer you want to box.

References Loyc.Collections.CG.Cache().

◆ Cache() [5/8]

static object Loyc.Collections.CG.Cache ( object  o)
inlinestatic

Passes the object through a thread-static instance of SimpleCache<o>.

If o is a string, an alternative to Caching is interning (String.Intern("...")). The latter tends to be more dangerous because an interned string can never be garbage-collected.

Note that SimpleCache<T> contains strong references to cached items, and the maximum cache size is 1024 items. The references are released when the current thread terminates or when you call ObjectCache.Clear().

References Loyc.Collections.CG.ObjectCache.

Referenced by Loyc.Collections.CG.Cache().

◆ Cache() [6/8]

static object Loyc.Collections.CG.Cache ( sbyte  o)
inlinestatic

Special overload to avoid treating argument as int32 in C#.

References Loyc.Collections.CG.Cache().

Referenced by Loyc.Collections.CG.Cache().

◆ Cache() [7/8]

static object Loyc.Collections.CG.Cache ( short  o)
inlinestatic

Special overload to avoid treating argument as int32 in C#.

References Loyc.Collections.CG.Cache().

Referenced by Loyc.Collections.CG.Cache().

◆ Cache() [8/8]

static object Loyc.Collections.CG.Cache ( ushort  o)
inlinestatic

Special overload to avoid treating argument as int32 in C#.

References Loyc.Collections.CG.Cache().

Referenced by Loyc.Collections.CG.Cache().

Property Documentation

◆ ObjectCache

SimpleCache<object>?? Loyc.Collections.CG.ObjectCache
staticget

Gets the cache used by Cache(object).

Referenced by Loyc.Collections.CG.Cache().