C#C
C#2y ago
RumTery

Hide private partial class/struct members

I am generating code based on a given class, this partial class contains a generated public interface and generated private members. Is it possible to hide the visibility of private members for the original non-generated class?

Some code example
[System]
internal partial class IterativeSystem
{
    [SystemCall]
    public void Do(int a, ref int b)
    {
        
    }
}

internal partial class IterativeSystem
{
    private static Type[] _mutTypes = [typeof(int)];
    private static Type[] _readTypes = [typeof(int)];
    public ReadOnlySpan<Type> MutTypes => _mutTypes;
    public ReadOnlySpan<Type> ReadTypes => _readTypes;

    public void Update()
    {
        // __DoCall(IRuntimeContext.Current.World);
    }

    private readonly QueryDescription __DoQuery;
    private void __DoCall(World world)
    {
        var query = world.Query(in __DoQuery);
        foreach (ref var chunk in query)
        {
            var componentsFirst = chunk.GetFirst<int, int>();
            foreach (var entityIndex in chunk)
            {
                ref var t0Component = ref Unsafe.Add(ref componentsFirst.t0, entityIndex);
                ref var t1Component = ref Unsafe.Add(ref componentsFirst.t1, entityIndex);
                Do(t0Component, ref t1Component);
            }
        }
    }
}
Was this page helpful?