Я пытаюсь выполнить динамические лямбда-выражения для коллекции объектов IPointCurve. Всякий раз, когда я ссылаюсь на свойство, которое существует в сборке Autodesk.Inventor.Interop, я получаю ошибку, указанную в заголовке. _TempPoint работает как положено. _result содержит ошибку. Есть предложения?
IPointCurve _tempPoint = _occPoints.GetMinXPointTemp(_x => _x.Curve.CurveType == CurveTypeEnum.kLineSegmentCurve);
Task<Func<IPointCurve, bool>> _result = _getPointCurveLambdaExpression("_x => _x.Curve.CurveType == CurveTypeEnum.kLineSegmentCurve");
public interface IPointCurve
{
double X { get; }
double Y { get; }
double Length { get; set; }
// This is a member of AutoDesk.Inventor.Interop.
PointIntentEnum PointType { get; }
// This is a member of AutoDesk.Inventor.Interop.
Point2d Point { get; }
int GetHashCode();
// This is a member of AutoDesk.Inventor.Interop.
DrawingCurve Curve { get; }
string OccPath { get; }
string ToString();
double GetXAverage();
double GetYAverage();
}
private async Task<Func<IPointCurve, bool>> _getPointCurveLambdaExpression(string _expression)
{
var _options = ScriptOptions.Default.AddReferences(typeof(IPointCurve).Assembly);
// _options.WithImports("Inventor");
Func<IPointCurve, bool> _filterExpression = await CSharpScript.EvaluateAsync<Func<IPointCurve, bool>>(_expression, _options);
return _filterExpression;
}