vassilych / cscs

CSCS: Customized Scripting in C#
MIT License
166 stars 47 forks source link

Added the ability to merge cells with the OBJECT type #31

Closed stv233 closed 1 year ago

stv233 commented 1 year ago

Added the ability to merge cells with the OBJECT type if the required operation is defined for the ObjectType of the cells. If the required operation is not defined in the type, the cells will be merged as a string.

vassilych commented 1 year ago

Привет, Михаил!

Благодарю за контрибуцию к проекту. Вопрос, почему так сложно:

typeof(Parser).GetMethod("MergeObjects", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static) .MakeGenericMethod(leftCell.ObjectType) .Invoke(null, new object[] { leftCell, rightCell, script });

А не просто MergeObjects(...); Overhead ведь из-за Reflection?

Василий

On Sat, Nov 12, 2022 at 5:08 PM Mikhail Glazatov @.***> wrote:

Added the ability to merge cells with the OBJECT type if the required operation is defined for the ObjectType of the cells. If the required operation is not defined in the type, the cells will be merged as a string.

You can view, comment on, or merge this pull request online at:

https://github.com/vassilych/cscs/pull/31 Commit Summary

File Changes

(1 file https://github.com/vassilych/cscs/pull/31/files)

Patch Links:

— Reply to this email directly, view it on GitHub https://github.com/vassilych/cscs/pull/31, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE74VFGZ45ZIAEP6KKIY7YDWH66G5ANCNFSM6AAAAAAR6MHBJI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

stv233 commented 1 year ago

Здравствуйте Василий.

Я использовал Reflection в этом случае поскольку мне был необходим индификатор типа, который хранит переменная, для использования в делегате Func в выражениях. Для приведения экземпляра Type, хранимого в переменной, в индификатор типа мне пришлось использовать метод MakeGenericMethod из Reflection.

Михаил

vassilych commented 1 year ago

Михаил, добрый вечер!

Я мигрировал код с объектами и также сделал изменение, чтоб это работало без Рефлекции. Дайте знать, если работает. А также, какой лучше всего скрипт для тестирования правильных операций с двумя объектами?

Василий

On Sun, Nov 13, 2022 at 4:43 PM Mikhail Glazatov @.***> wrote:

Здравствуйте Василий,

Я использовал Reflection в этом случае поскольку мне был необходим индификатор типа, который хранит переменная, для использования в делегате Func в выражениях. Для приведения экземпляра Type, хранимого в переменной, в индификатор типа мне пришлось использовать метод MakeGenericMethod из Reflection.

Михаил

— Reply to this email directly, view it on GitHub https://github.com/vassilych/cscs/pull/31#issuecomment-1312760175, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE74VFB3Z45UQZMB7PZM2LLWIEEBXANCNFSM6AAAAAAR6MHBJI . You are receiving this because you commented.Message ID: @.***>