logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class ObjectUtils

    Utility class for object operations

    Inheritance
    object
    ObjectUtils
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Serenity.Shared.Utils
    Assembly: Serenity.Shared.dll
    Syntax
    public static class ObjectUtils

    Methods

    GenerateGuid(string)

    Generate a new GUID as a string

    Declaration
    public static string GenerateGuid(string format = "D")
    Parameters
    Type Name Description
    string format
    Returns
    Type Description
    string

    A new GUID in string format

    GetImplementingClasses<T>()

    Get types of all classes that implement a specified interface

    Declaration
    public static Type[] GetImplementingClasses<T>()
    Returns
    Type Description
    Type[]

    An array of types of the implementing classes

    Type Parameters
    Name Description
    T

    The interface type

    GetInheritedClasses<T>()

    Get instances of all classes that inherit from a specified base class

    Declaration
    public static T[] GetInheritedClasses<T>()
    Returns
    Type Description
    T[]

    An array of instances of the inherited classes

    Type Parameters
    Name Description
    T

    The base class type

    GetTypeFromCurrentDomainAssemblies(string)

    Get a Type by name from the currently loaded assemblies in the AppDomain

    Declaration
    public static Type GetTypeFromCurrentDomainAssemblies(string typeName)
    Parameters
    Type Name Description
    string typeName

    The full name of the type to find

    Returns
    Type Description
    Type

    The Type if found; otherwise, null

    Remarks

    Answered from a lazily built index rather than by scanning. The scan walked every assembly and materialized every type — twice — on every call that missed the GetType(string) fast path, which measured at seconds per call in a loaded editor. Callers re-resolve while text is being typed, so each keystroke of a partial type name paid that in full and froze the editor. The index costs one scan the first time this fallback is needed at all, and nothing after; it rebuilds itself when the number of loaded assemblies changes.

    WarmTypeIndex()

    Builds the type-name index ahead of need. Safe to call from any thread.

    Declaration
    public static void WarmTypeIndex()
    Remarks

    The index is built lazily, so without this the first lookup that misses the fast path pays the one-time build — several seconds in a large editor domain, landing on whatever keystroke happened to come first. A tool that knows type names are about to be typed calls this from a background thread when it opens; by the time the author reaches the field, lookups are dictionary hits.

    In this article
    © 2026 Serenity. All Rights Reserved