using dynamic class resulting cannot convert from .InstrumentIdentifierList to SubjectIdentifierList

YD
YD Newcomer

I'm using reflection to use the list of objects of extrationrequest but having issue setting the instrument list when using dynamic class.

for example - using the code

dynamic obj = new CommoditiesCorrectionsHistoryExtractionRequest();

this will work good

extractionRequest.IdentifierList = InstrumentIdentifierList.Create(

new[]

{

new InstrumentIdentifier { Identifier = "191216100", IdentifierType = IdentifierType.Cusip,UserDefinedIdentifier = "AA" }

}, null, false);


this way, error was raised

Type[] typelist = GetTypesInNamespace(myAssembly, "ThomsonReuters.Dss.Api.Extractions.ExtractionRequests");

Type tt = typelist[0] //CommoditiesCorrectionsHistoryExtractionRequest

dynamic obj = Activator.CreateInstance(tt);

error will be raised

extractionRequest.IdentifierList = InstrumentIdentifierList.Create(

new[]

{

new InstrumentIdentifier { Identifier = "191216100", IdentifierType = IdentifierType.Cusip,UserDefinedIdentifier = "AA" }

}, null, false);

Best Answer

  • YD
    YD Newcomer
    Answer ✓

    the issue was resolved by getting the correct assembly execution path -

    Assembly.GetExecutingAssembly().Location