Skip to content

Commit

Permalink
.NET: Add GetNativeSingletonT/GetManagedSingletonT
Browse files Browse the repository at this point in the history
  • Loading branch information
praydog committed Mar 27, 2024
1 parent 82dcd44 commit 17a5fe6
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions csharp-api/REFrameworkNET/API.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,18 @@ public ref class API
return gcnew NativeObject(result, t);
}

generic <typename T>
static T GetNativeSingletonT() {
auto fullName = T::typeid->FullName;
return GetNativeSingleton(fullName)->As<T>();
}

generic <typename T>
static T GetManagedSingletonT() {
auto fullName = T::typeid->FullName;
return GetManagedSingleton(fullName)->As<T>();
}

static reframework::API* GetNativeImplementation() {
if (s_api == nullptr) {
throw gcnew APINotInitializedException();
Expand Down

0 comments on commit 17a5fe6

Please sign in to comment.