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

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().

Referenced by Loyc.Ecs.Parser.EcsLexer.Error(), Loyc.Syntax.Les.Les2Lexer.ParseIdentifier(), Loyc.Syntax.Les.Les2Lexer.ParseNumberCore(), and Loyc.Syntax.Les.Les2Lexer.SupportDotIndents().

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.
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().

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().

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().

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().

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().

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.

Property Documentation

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

Gets the cache used by Cache(object).