本文整理汇总了C#中System.Dynamic.SetMemberBinder类的典型用法代码示例。如果您正苦于以下问题:C# SetMemberBinder类的具体用法?C# SetMemberBinder怎么用?C# SetMemberBinder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SetMemberBinder类属于System.Dynamic命名空间,在下文中一共展示了SetMemberBinder类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: TrySetMember
public override bool TrySetMember( SetMemberBinder binder, object value )
{
string str = value as string;
if ( str != null )
{
switch ( binder.Name )
{
case "tagName":
throw new NotSupportedException( "元素名不能被修改" );
case "innerText":
Element.InnerText( str );
return true;
case "innerHTML":
Element.InnerHtml( str );
return true;
}
Element.SetAttribute( binder.Name, str );
}
return false;
}
开发者ID:ajayumi,项目名称:Jumony,代码行数:28,代码来源:DynamicElement.cs
示例2: BindSetMember
public override DynamicMetaObject BindSetMember(SetMemberBinder binder,
DynamicMetaObject value)
{
// Method to call in the containing class:
string methodName = "SetDictionaryEntry";
// setup the binding restrictions.
BindingRestrictions restrictions =
BindingRestrictions.GetTypeRestriction(Expression, LimitType);
// setup the parameters:
Expression[] args = new Expression[2];
// First parameter is the name of the property to Set
args[0] = Expression.Constant(binder.Name);
// Second parameter is the value
args[1] = Expression.Convert(value.Expression, typeof(object));
// Setup the 'this' reference
Expression self = Expression.Convert(Expression, base.LimitType);
// Setup the method call expression
Expression methodCall = Expression.Call(self,
typeof(DynamicDictionary).GetMethod(methodName),
args);
// Create a meta object to invoke Set later:
DynamicMetaObject setDictionaryEntry = new DynamicMetaObject(
methodCall,
restrictions);
// return that dynamic object
return setDictionaryEntry;
}
开发者ID:JIANGSHUILANG,项目名称:TestSelfblog,代码行数:27,代码来源:DynamicDictionary.cs
示例3: TrySetMember
public override bool TrySetMember(SetMemberBinder binder, object value)
{
//if this is not a DomainProperty...
if (!objectInstance.ObjectDefinition.Properties.ContainsKey(binder.Name))
{
//...try to set it as a normal property
PropertyInfo propInfo = this.proxiedObject.GetType().GetProperty(binder.Name);
if (propInfo != null)
{
propInfo.SetValue(this.proxiedObject, value, null);
return true;
}
else //property not found.
{
if (Debugger.IsAttached)
{
Debug.WriteLine("BOVProxy TrySetMember failed: Property '{0}' could not be found on object '{1}'", binder.Name, objectInstance.ObjectDefinition.SystemName);
}
return false;
}
}
else
{
var propertyDefinition = objectInstance.ObjectDefinition.Properties[binder.Name];
var propertyValue = propertyDefinition.GetUntypedValue(objectInstance);
propertyValue.StringValue = value.ToString();
return true;
}
}
开发者ID:TLevitt,项目名称:DryLogic,代码行数:29,代码来源:DryLogicProxy.cs
示例4: TrySetMember
public override bool TrySetMember(SetMemberBinder binder, object value)
{
if (value.GetType().IsValueType || value is string)
{
var existing = Attributes.FirstOrDefault(a => a.Name.LocalName.EqualsIgnoreCase(binder.Name));
if (existing != null)
{
Attributes.Remove(existing);
}
Attributes.Add(new XAttribute(binder.Name, value));
}
var element = Elements.FirstOrDefault(a => a.Name.EqualsIgnoreCase(binder.Name));
if (element != null)
{
Elements.Remove(element);
}
Elements.Add(Serialize(value));
return true;
}
开发者ID:TheEvilDev,项目名称:ConfigurationFx,代码行数:25,代码来源:DynamicXmlNode.cs
示例5: TrySetMember
public override bool TrySetMember(SetMemberBinder binder, object value)
{
if (value == null)
throw new NotSupportedException("Cannot set null value for item properties.");
if (dteProject != null)
{
Property property;
try
{
property = dteProject?.Value?.Properties.Item(binder.Name);
}
catch (ArgumentException)
{
property = null;
}
if (property != null)
{
try
{
property.Value = value;
return true;
}
catch
{
return false;
}
}
}
return false;
}
开发者ID:alphaleonis,项目名称:AlphaVSX,代码行数:33,代码来源:ProjectProperties.cs
示例6: TrySetMember
public override bool TrySetMember(SetMemberBinder binder, object value)
{
var retVal = _row.Table.Columns.Contains(binder.Name);
if (retVal)
_row[binder.Name] = value;
return retVal;
}
开发者ID:J4S0Nc,项目名称:Useful.Utilities,代码行数:7,代码来源:DynamicRow.cs
示例7: TrySetMember
public override bool TrySetMember(SetMemberBinder binder, object value)
{
viewData[binder.Name] = value;
HttpContext.Current.Items[this.GetType()] = this;
return true;
}
开发者ID:rexwhitten,项目名称:Siege,代码行数:7,代码来源:ViewModel.cs
示例8: TrySetMember
public override bool TrySetMember(SetMemberBinder binder, object value)
{
Console.WriteLine("TrySetMember");
new IHTMLPre { innerText = "TrySetMember: " + new { value } }.AttachToDocument();
return true;
}
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:7,代码来源:Application.cs
示例9: TrySetMember
public override bool TrySetMember(SetMemberBinder binder, object value)
{
InternalValues[binder.Name] = value;
FirePropertyChanged(binder.Name);
return true;
}
开发者ID:NikolayKostadinov,项目名称:TelerikAkademy,代码行数:7,代码来源:DynamicDictionary.cs
示例10: TrySetMember
public override bool TrySetMember(SetMemberBinder binder, object value)
{
var key = binder.Name;
AddOrUpdateSetting(key, (string)value);
return true;
}
开发者ID:Code52,项目名称:Ideastrike,代码行数:7,代码来源:Settings.cs
示例11: TrySetMember
public override bool TrySetMember(SetMemberBinder binder, object value) {
if (!jsonObject.ContainsKey(binder.Name))
jsonObject.Add(binder.Name, (dynamic)value);
else
jsonObject[binder.Name] = (dynamic)value;
return true;
}
开发者ID:curtisrutland,项目名称:RottenTomatoes.NET,代码行数:7,代码来源:DynamicJsonObject.cs
示例12: TrySetMember
public override bool TrySetMember(SetMemberBinder binder, object value)
{
var name = binder.Name;
_properties[name] = value;
return true;
}
开发者ID:gregnehus,项目名称:MalleableObject,代码行数:7,代码来源:MalleableObject.cs
示例13: TrySetMember
public override bool TrySetMember(SetMemberBinder binder, object value)
{
// cache location
// this class if for floats. ints will need their own class
var isvec2 = value is __vec2;
if (isvec2)
{
var value_vec2 = (__vec2)value;
gl.uniform2f(
gl.getUniformLocation(program, binder.Name),
value_vec2
);
return true;
}
var isvec3 = value is __vec3;
if (isvec3)
{
var value_vec3 = (__vec3)value;
gl.uniform3f(
gl.getUniformLocation(program, binder.Name),
value_vec3
);
return true;
}
gl.uniform1f(gl.getUniformLocation(program, binder.Name), (float)value);
return true;
}
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:35,代码来源:WebGLDynamicUniforms.cs
示例14: TrySetMember
public override bool TrySetMember(SetMemberBinder binder, object value)
{
_data[binder.Name] = value;
OnPropertyChanged(binder.Name);
OnPropertyChanged("");
return true;
}
开发者ID:expanz,项目名称:expanz-Microsoft-XAML-SDKs,代码行数:7,代码来源:DynamicDataObject.cs
示例15: TrySetMember
public override bool TrySetMember(SetMemberBinder binder, object value)
{
string propertyName = binder.Name;
this.dictionary[propertyName] = value;
return true;
}
开发者ID:Motaz-Al-Zoubi,项目名称:xaml-sdk,代码行数:7,代码来源:DynamicDataObject.cs
示例16: TrySetMember
public override bool TrySetMember(
SetMemberBinder binder, object value)
{
_dictionary[binder.Name] = value;
return true;
}
开发者ID:al-main,项目名称:James.Testing,代码行数:7,代码来源:DynamicDictionary.cs
示例17: TrySetMember
public override bool TrySetMember(SetMemberBinder binder, object value)
{
var child = elementFactory.CreateElementWithNameForParent(binder.Name, element);
element.AddChild(child);
child.AddChild(elementFactory.CreateElementWithContentForParent(value?.ToString() ?? string.Empty, child));
return true;
}
开发者ID:baks,项目名称:Simple.Xml,代码行数:7,代码来源:DynamicElement.cs
示例18: TrySetMember
public bool TrySetMember(SetMemberBinder binder, object value, TrySetMemberDelegate baseTrySetMember)
{
if (!accessor.TrySetProperty(binder.Name, value))
return baseTrySetMember(binder, value);
return true;
}
开发者ID:MobileEssentials,项目名称:clide,代码行数:7,代码来源:DynamicPropertyAccessor.cs
示例19: TrySetMember
public override bool TrySetMember(SetMemberBinder binder, object value)
{
methodStubs[binder.Name] = value;
RecordExecution(binder.Name, new object[] { value }, null, null);
return true;
}
开发者ID:eugman,项目名称:Oak,代码行数:8,代码来源:Mock.cs
示例20: TrySetMember
public override bool TrySetMember(SetMemberBinder binder, object value)
{
if (!(value is IWrapper))
value = Wrapper.Create(value, dynamicProperties);
viewData[binder.Name] = value;
return true;
}
开发者ID:modulexcite,项目名称:Bandage,代码行数:8,代码来源:DynamicViewModel.cs
注:本文中的System.Dynamic.SetMemberBinder类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论