Error CS0518: Predefined type 'Microsoft.CSharp.RuntimeBinder.Binder' is not defined or imported.

Created at 30 Aug 2020, 05:23
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
FA

fang0092

Joined 08.06.2019

Error CS0518: Predefined type 'Microsoft.CSharp.RuntimeBinder.Binder' is not defined or imported.
30 Aug 2020, 05:23


Im hoping to create a list which stores several lists so I did this.                        

var temp_list = new List<dynamic>();
temp_list.Add(new List<double> 
                        {
                            1.23,
                            2.34
                        });
temp_list.Add(new List<string> 
                        {
                            "abc",
                            "def"
                        });
foreach (float item in temp_list)
                        {
                            Print(item);
                        }


However, Im getting an error: Error CS0518: Predefined type 'Microsoft.CSharp.RuntimeBinder.Binder' is not defined or imported.
What am I lacking? Im already using the ones below:

using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
using System.Collections.Generic;

namespace cAlgo


@fang0092
Replies

firemyst
30 Aug 2020, 12:36

In Visual Studio:

  • Right Click on your project and select 'Add reference'

  • Select 'Assemblies->Framework' in 'Reference Manager' window.

  • Add select Microsoft.CSharp.dll and click on add

 

You might also try this link:

https://stackoverflow.com/questions/13566887/dynamic-in-the-immediate-window-causes-microsoft-csharp-runtimebinder-binder-i?lq=1

 


@firemyst

fang0092
04 Sep 2020, 01:49

RE:

firemyst said:

In Visual Studio:

  • Right Click on your project and select 'Add reference'

  • Select 'Assemblies->Framework' in 'Reference Manager' window.

  • Add select Microsoft.CSharp.dll and click on add

 

You might also try this link:

https://stackoverflow.com/questions/13566887/dynamic-in-the-immediate-window-causes-microsoft-csharp-runtimebinder-binder-i?lq=1

 

- I got the path of Microsoft.CSharp.dll from the objects manager of Visual Studio

- I right click my code in ctrader, selected add reference, and pasted the path

 

Seems to be working. Thank you.


@fang0092