Enhanced C#
Language of your choice: library documentation
Namespaces | Classes | Enumerations | Functions
Loyc Namespace Reference

Main Loyc namespace. This namespace includes all general-purpose code in the Loyc megaproject. It includes the code of Loyc.Essentials.dll and Loyc.Collections.dll (collections, geometry, MiniTest, MessageSink, etc.), and also the code of Loyc.Syntax.dll. More...

Namespaces

namespace  Collections
 Contains general-purpose interfaces (Loyc.Collections.IListSource<T>, ranges, etc.), collection implementations (Loyc.Collections.DList<T>, Loyc.Collections.WeakValueDictionary<K,V>, etc.), extension methods (Loyc.Collections.LCExt, Loyc.Collections.EnumerableExt, etc.), helper classes (Loyc.Collections.EmptyList<T>, (Loyc.Collections.Repeated<T>, etc.), and adapter classes (Loyc.Collections.ListSlice<T>, Loyc.Collections.BufferedSequence<T>, etc.).
 
namespace  Compatibility
 Important interfaces of newer .NET versions than the version for which Loyc was compiled
 
namespace  Ecs
 Classes related to Enhanced C# (mostly found in Loyc.Ecs.dll).
 
namespace  Geometry
 Contains math code and data types for processing geometry (points, lines, polygons, etc.). Basic geometry stuff is in Loyc.Essentials.dll, while more advanced algorithms are found in Loyc.Utilities.dll.
 
namespace  LLParserGenerator
 Code related to LLLPG, the Loyc LL(k) Parser Generator (LLLPG.exe).
 
namespace  LLPG
 Contains macros for using LLLPG in LeMP.
 
namespace  Math
 Contains general-purpose math algorithms beyond what is provided in the .NET BCL (Base Class Library). Notable class: Math.MathEx.
 
namespace  MiniTest
 A stripped-down NUnit lookalike which allows you to put simple unit tests in an assembly without having to add a reference to NUnit.Framework.dll.
 
namespace  Syntax
 Loyc.Syntax.dll: contains Loyc trees (Loyc.Syntax.LNode), lexing stuff, LLLPG base classes (BaseParser{T} and BaseLexer), the LES parser and printer, data types related to source code management (e.g. ISourceFile, SourceRange) and other general-purpose code related to the manipulation of syntax.
 
namespace  Threading
 Helper classes for multithreaded code.
 
namespace  Utilities
 Contains general-purpose classes that are not considered important enough to go directly into the Loyc namespace. Most of the classes in this namespace are defined in Loyc.Utilities.dll.
 

Classes

class  CheckParam
 Helper methods for checking argument values that throw exceptions when an argument value is not acceptable. More...
 
class  ConcurrentModificationException
 An exception thrown when a data structure is accessed (read or written) by one thread at the same time as it is modified on another thread. More...
 
class  ConsoleMessageSink
 Sends all messages to System.Console.WriteLine(), with hard-coded colors for Error, Warning, Note, Verbose, and Detail. More...
 
class  ExceptionExt
 Extension methods for exceptions. More...
 
struct  EzStopwatch
 A wrapper around Stopwatch with a more convenient interface, currently oriented around measuring milliseconds (TODO: increase similarity to Stopwatch) More...
 
class  G
 Contains global functions that don't belong in any specific class. More...
 
class  GoInterfaceBenchmark
 
class  GSymbol
 This class produces global symbols. More...
 
class  HashTags
 An implementation of IAttributes that can hold one attribute before allocating any memory for a hashtable. It is intended to be used as a base class but can be used on its own. More...
 
class  Holder
 A trivial class that holds a single value of type T in the Value property. More...
 
interface  ICloneable
 Interface for types that can duplicate themselves. More...
 
interface  IHasLocation
 This interface allows an object to declare its "location". More...
 
interface  IHasValue
 Interface for things that have a Value property. More...
 
interface  IMessageSink
 A general-purpose interface for a class that accepts formatted messages with context information. More...
 
class  InvalidStateException
 An exception thrown when an object detects that its own state is invalid, or in other words, that an invariant has been violated. More...
 
interface  IReferenceComparable
 This is a tag which indicates that objects of this type are unique; specifically, any two different objects that implement this interface are always unequal, and one object is equal only to itself. More...
 
interface  ITags
 Interface for an object that can have "tags" attached, which are arbitrary objects reached through a key Symbol. More...
 
class  LocalizableAttribute
 I plan to use this attribute someday to gather all the localizable strings in an application. This attribute should be applied to a string function parameter if the method calls Localized() using that parameter as the format string. More...
 
class  Localize
 Localize is a global hook into which a string-mapping localizer can be installed. It is designed to make internationalization exceptionally easy for developers. TODO: expand I18N features based on Mozilla's L20N. More...
 
class  LogException
 An exception that includes a "context" object as part of a LogMessage structure, typically used to indicate where an error occurred. More...
 
struct  LogMessage
 Holds an argument list compatible with IMessageSink.Write. Typically used with MessageHolder. More...
 
class  Maybe
 
class  MemoizedTypeName
 .NET Framework reflection doesn't offer complete type names for generic types such as "List&lt;int>" (the Type.Name value of that class is "List`1"). Get fills in the gap, and also saves the computed name for fast repeated lookups. More...
 
class  MessageFilter
 A decorator that uses a delegate to accept or ignore messages. More...
 
class  MessageHolder
 A message sink that puts the messages it receives in a list. More...
 
class  MessageSink
 Holds the default message sink for this thread (Current), Symbols for the common message types, such as Warning and Error, and default instances of ConsoleMessageSink, TraceMessageSink and NullMessageSink. More...
 
class  MessageSinkFromDelegate
 This helper class lets you implement IMessageSink with one or two delegates (a writer method, and an optional severity filter). More...
 
class  MessageSplitter
 A message sink that sends its messages to a list of other sinks. More...
 
class  NoValue
 NoValue.Value is meant to be used as the value of a property that has "no value", meaning no value is assigned or that the property is meaningless at the current time or in the current context. More...
 
class  NullMessageSink
 Discards all messages. However, there is a Count property that increases by one with each message received, as well as an ErrorCount. More...
 
class  Pair
 Pair.Create(a, b) is a helper method for making pairs. More...
 
class  Range
 
class  ReadOnlyException
 An exception thrown when an attempt is made to modify a read-only object. More...
 
class  ReferenceComparer
 An IEqualityComparer<T> based on reference equality More...
 
class  SeverityMessageFilter
 A decorator (wrapper) for IMessageSink that filters out some messages if their Severity is too low, according to the value of the MinSeverity property. More...
 
class  StringBuilderExt
 Extension methods that add some functionality of string to StringBuilder. More...
 
class  StringExt
 Extension methods for strings, such as SplitAt, Left, Right, Format and Slice. More...
 
class  Symbol
 Represents a symbol, which is a singleton string that supports fast comparisons and extensible enums. More...
 
class  SymbolPool
 A collection of Symbols. More...
 
class  SymbolSet
 A set of symbols. More...
 
class  TraceMessageSink
 Sends all messages to System.Diagnostics.Trace.WriteLine(string). More...
 
struct  Triplet
 A tuple of three values (A, B and C) in a struct. More...
 
class  TypeExt
 Extension methods for Type. More...
 
struct  UString
 UString is a slice of a string. It is a wrapper around string that provides a IBRange<T> of 21-bit UCS-4 characters. "U" stands for "Unicode", as in UCS-4, as opposed to a normal string that is UTF-16. More...
 
class  ValueComparer
 You'd think the .NET framework would have a built-in method–even a CIL opcode–to bitwise-compare two values. Not supporting bitwise compare is, in my opinion, one of several mind-bogglingly dumb decisions in the CLR. Instead, all you can do is call ValueComparer.Default.Equals(a, b). More...
 
struct  void
 .Value represents the sole value of System.Void (called "void" in C#). More...
 
class  WeakReferenceExt
 The new WeakReference<T> type in .NET 4.5 removes the Target and IsAlive properties. These extension methods restore that traditional functionality, making it easier to transition from the old WeakReference to the new one. More...
 
class  WrapperBase
 Abstract class that helps you implement wrappers by automatically forwarding calls to Equals(), GetHashCode() and ToString(). More...
 

Enumerations

enum  Severity {
  Detail = 0, Verbose = 10, _Finer = 20,
  Debug = 30, _Info = 40, Note = 50,
  Warning = 60, Error = 70, _Severe = 80,
  Critical = 90, _Alert = 100, Fatal = 110,
  _Emergency = 120
}
 A linear scale to categorize the importance and seriousness of messages sent to IMessageSink. More...
 

Functions

delegate string WriterDelegate (string format, params object[] args)
 
delegate void WriteMessageFn (Severity type, object context, string format, params object[] args)
 This is the method signature of IMessageSink.Write(). You can convert from one of these delegates to IMessageSink by calling MessageSink.FromDelegate. More...
 
delegate string FormatterDelegate (string format, params object[] args)
 
delegate string LocalizerDelegate (Symbol msgId, string msg)
 

Detailed Description

Main Loyc namespace. This namespace includes all general-purpose code in the Loyc megaproject. It includes the code of Loyc.Essentials.dll and Loyc.Collections.dll (collections, geometry, MiniTest, MessageSink, etc.), and also the code of Loyc.Syntax.dll.

Enumeration Type Documentation

enum Loyc.Severity
strong

A linear scale to categorize the importance and seriousness of messages sent to IMessageSink.

The numbers are Fatal=110, Critical=90, Error=70, Warning=60, Note=50, Debug=30, Verbose=10 and Detail=0. The severity numbers are based on those defined in log4net, divided by 1000, e.g. Warning=60000 in log4net but 60 in this enum.

Some of the enumeration values begin with an underscore. These are values defined by Log4net that are deprecated in LoycCore.

Messages of type Detail are meant to contain extra information associated with the most recent non-Detail message, e.g. stack traces or extra diagnostic information for Errors.

Function Documentation

delegate void Loyc.WriteMessageFn ( Severity  type,
object  context,
string  format,
params object[]  args 
)

This is the method signature of IMessageSink.Write(). You can convert from one of these delegates to IMessageSink by calling MessageSink.FromDelegate.

Parameters
typeSeverity or importance of the message; widely-used types include Error, Warning, Note, Debug, and Verbose. The special type Detail is intended to provide more information about a previous message.
contextAn object that represents the location that the message applies to, a string that indicates what the program was doing when the message was generated, or any other relevant context information. See also MessageSink.LocationString().
formatA message to display. If there are additional arguments, placeholders such as {0} and {1} refer to these arguments.
argsOptional arguments to fill in placeholders in the format string.