Table of Contents

Class AssemblyExtensions

Namespace
Squiggles.Core.Extension
Assembly
SquigglesCommon4X.dll

SC4X Extensions for System.Reflection.Assembly

public static class AssemblyExtensions
Inheritance
AssemblyExtensions
Inherited Members

Methods

InstanceClassOrNullSimple<T>(Assembly, string)

An incredibly naive reflection based type loading function. Given the full class name and expected type, tries to instance an object, returning null when failing. If an error occurs during the loading process a warning with a stack trace will be emitted. This method does require an explicit constructor that takes no arguments in order to work properly. This was originally created to help me with a specific implementation, which proved to be less efficient than using Godot's Resource so I scrapped the idea. But this utility exists just in case someone finds a use for it. Reflection is pretty powerful so use it wisely.

public static T InstanceClassOrNullSimple<T>(this Assembly assem, string classNameFull) where T : class

Parameters

assem Assembly

The target assembly. If no fancy C# work has been done, all of Squiggles.Core as well as your game code should be in the currently executing assembly.

classNameFull string

The full name of the class. For this class, that would be "Squiggles.Core.Extension.AssemblyExtensions", but of course as a static class it couldn't be instanced.

Returns

T

The instance of T, or null if a failure occurred

Type Parameters

T

The type for the instance to expect and be cast to