RData object in COM API

Hi, I have a situation where there are many requests at a time. In order to not get the replies mixed up with each other, I wanted to have a single Dex2Manager that creates multiple RData objects (which are the multiple requests). Would that be a correct way of handling this situation, or is there another/better way?


Thanks.

Best Answer

  • Jirapongse
    Jirapongse ✭✭✭✭✭
    Answer ✓

    @Maya.Uemura

    From the question, I assume that you would like to how to get the RData object which can be used inside the OnUpdateEventHandler. There are several ways to do it, such as creating a new class that wraps around the RData object or using the lambda function in .NET.

    For the lambda function, the code looks like:

                var myRData = MyDex2Mgr.CreateRData(MyDex2Cookie);
                myRData.OnUpdate += (DEX2_DataStatus DataStatus, object responseError) =>
                {
                    ...
                    Array l_response = myRData.Data as Array;
    ...
                };

    By using the lambda function, the myRData object can be used inside the OnUpdate event handler.