Skip to content

Commit 28e6e92

Browse files
committed
feat(managed): Add helper to get schema size
1 parent 1b01558 commit 28e6e92

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

managed/src/SwiftlyS2.Shared/Helper.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,16 @@ public static T AsSchema<T>( nint ptr ) where T : ISchemaClass<T>
8888
return T.From(ptr);
8989
}
9090

91+
/// <summary>
92+
/// Get the size of a schema class.
93+
/// </summary>
94+
/// <typeparam name="T">The schema class to get the size of.</typeparam>
95+
/// <returns>The size of the schema class.</returns>
96+
public static int GetSchemaSize<T>() where T : ISchemaClass<T>
97+
{
98+
return T.Size;
99+
}
100+
91101
/// <summary>
92102
/// Estimates the display width of a character based on its type.
93103
/// Inspired by: https://github.com/spectreconsole/wcwidth

0 commit comments

Comments
 (0)