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  ByteArrayInString
 Encodes and decodes BAIS (Byte Array In String) encoding, which preserves runs of ASCII characters unchanged. This encoding is useful for debugging (since ASCII runs are visible) and for conversion of bytes to JSON. More...
 
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...
 
struct  Either
 Holds a single value of one of two types (L or R). 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  IEither
 Represents a type that holds a single value of one of two types (L or R). More...
 
interface  IHasLocation
 This interface allows an object to declare its "location". More...
 
interface  IHasMutableValue
 Interface for things that have a mutable Value property. More...
 
interface  IHasValue
 Interface for things that have a Value property. More...
 
interface  ILogMessage
 A formatted message with an associated Context. More...
 
interface  IMaybe
 
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  IReferenceEquatable
 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, or passes it to another localizing method. More...
 
class  Localize
 Localize is a global hook into which a string-mapping localizer can be installed. It makes your program localization-ready with no effort. See article: http://core.loyc.net/essentials/localize.html 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<TContext>.Write(Severity,TContext,string). 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  MessageMulticaster
 A message sink that sends its messages to a list of other sinks. More...
 
class  MessageSink
 Keeps track of the default message sink (Default); contains a series of helper methods; and contains extension methods modeled after log4net: Fatal, Error, Warn, Info, Debug. 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  MessageSinkWithContext
 A message sink wrapper that has a default value for the context parameter, which is used when the context provided is null, and an optional message prefix which is inserted at the beginning of the format string. 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  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  ServiceProvider
 Adds extension methods to modernize .NET's simple built-in service locator. 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, FormatCore 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...
 
class  Triplet
 
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
 @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 {
  VerboseDetail = 9, Verbose = 10, _Finer = 20,
  DebugDetail = 29, Debug = 30, InfoDetail = 39,
  Info = 40, NoteDetail = 49, Note = 50,
  WarningDetail = 59, Warning = 60, SpecialDetail = 65,
  Special = 66, ErrorDetail = 69, Error = 70,
  RareDetail = 79, Rare = 80, CriticalDetail = 89,
  Critical = 90, _Alert = 100, FatalDetail = 109,
  Fatal = 110, _Emergency = 120
}
 A linear scale to categorize the importance and seriousness of messages sent to IMessageSink. More...
 
enum  WordWrapCharType {
  WordWrapCharType.NoWrap = 0, WordWrapCharType.Space = 1, WordWrapCharType.BreakBefore = 2,
  WordWrapCharType.BreakAfter = 4, WordWrapCharType.Newline = 8
}
 The set of character categories recognized by overloads of G.WordWrap(string, int, Func<int, WordWrapCharType>). More...
 

Functions

delegate string FormatterDelegate (string format, params object[] args)
 
delegate string LocalizerDelegate (Symbol resourceId, string defaultMessage)
 
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 WriterDelegate (string format, params object[] args)
 

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

◆ Severity

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.

The "Detail" severity levels are meant to contain extra information associated with the most recent non-Detail message, e.g. stack traces or extra diagnostic information for Errors.

◆ WordWrapCharType

enum Loyc.WordWrapCharType
strong

The set of character categories recognized by overloads of G.WordWrap(string, int, Func<int, WordWrapCharType>).

Enumerator
NoWrap 

Represents a character on which not to wrap, such as a letter.

Space 

Represents a space character. Spaces are special because they do not consume physical space at the end of a line, so a line break never occurs before a space.

BreakBefore 

Represents a character before which a line break can be added.

BreakAfter 

Represents a character after which a line break can be added. The most common example of this category is a hyphen.

Newline 

Represents a forced-break (newline) character.

Function Documentation

◆ WriteMessageFn()

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