diff --git a/src/ComputeSharp.Shaders/Translation/Models/ReadableMember.cs b/src/ComputeSharp.Shaders/Translation/Models/ReadableMember.cs index 09507d2e..b0ba6344 100644 --- a/src/ComputeSharp.Shaders/Translation/Models/ReadableMember.cs +++ b/src/ComputeSharp.Shaders/Translation/Models/ReadableMember.cs @@ -30,6 +30,20 @@ namespace ComputeSharp.Shaders.Translation.Models Property = property; } + /// + /// Gets the where the current member is declared in + /// + public Type DeclaringType + { + get + { + if (Field != null) return Field.DeclaringType; + if (Property != null) return Property.DeclaringType; + + throw new InvalidOperationException("Field and property can't both be null at the same time"); + } + } + /// /// Gets the of the wrapped member for the current instance ///