Extending Unity.Collections with Partial?

Hi there,

I have seemingly odd request, I want to extend Unity.Collection Classes such as NativeList, NativeHashMap using partial. However as they live in their own package/assembly, and just adding a partial keyword there doesnt connect it to the cs file in unity folder.

Can please assist here? How can i achieve this usecase?

Thanks

I don’t think you can really use partial for this.

Is there any reason you can’t just write extension methods?

1 Like

Actually as i have lots of native collections of different types (List, HashMaps etc) and i want to use loops to represent all with one interface and clear, dispose and remove keys easily.

Currently i have to do this

            SharedRemovables = new Func<int, bool>[]
            {
                GridState.Remove,
                GridBonuses.Remove,

            };

            SharedClears = new Action[]
            {
                GridState.Clear,


                WordsHorizontalRange.Clear,
                WordsVerticalRange.Clear,
               
                GridBonuses.Clear,
               
               
                VisitedCells.Clear,
               

               
            };


            SharedDisposables = new IDisposable[]
            {
                GridState,


                WordsHorizontalRange,
                WordsVerticalRange,
               
                GridBonuses,
               
                VisitedCells,
               
                JobsResults,
            };