CSharpGetMemberBinder
using System;
using System.Collections.Generic;
using System.Dynamic;
namespace Microsoft.CSharp.RuntimeBinder
{
internal sealed class CSharpGetMemberBinder : GetMemberBinder, IInvokeOnGetBinder
{
private Type _callingContext;
private List<CSharpArgumentInfo> _argumentInfo;
private bool _bResultIndexed;
private RuntimeBinder _binder;
internal Type CallingContext => _callingContext;
internal IList<CSharpArgumentInfo> ArgumentInfo => _argumentInfo.AsReadOnly();
bool IInvokeOnGetBinder.InvokeOnGet {
get {
return !_bResultIndexed;
}
}
internal bool ResultIndexed => _bResultIndexed;
public CSharpGetMemberBinder(string name, bool resultIndexed, Type callingContext, IEnumerable<CSharpArgumentInfo> argumentInfo)
: base(name, false)
{
_bResultIndexed = resultIndexed;
_callingContext = callingContext;
_argumentInfo = BinderHelper.ToList(argumentInfo);
_binder = RuntimeBinder.GetInstance();
}
public override DynamicMetaObject FallbackGetMember(DynamicMetaObject target, DynamicMetaObject errorSuggestion)
{
return BinderHelper.Bind(this, _binder, new DynamicMetaObject[1] {
target
}, _argumentInfo, errorSuggestion);
}
}
}