本文整理汇总了C#中ICallable.Call方法的典型用法代码示例。如果您正苦于以下问题:C# ICallable.Call方法的具体用法?C# ICallable.Call怎么用?C# ICallable.Call使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICallable
的用法示例。
在下文中一共展示了ICallable.Call方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BlockTag
private void BlockTag(string tag, IDictionary attributes, ICallable block)
{
Output.Write("<{0}", tag);
System.Collections.Generic.List<string> attributeValues = new System.Collections.Generic.List<string>();
if (null != attributes)
{
foreach(DictionaryEntry entry in attributes)
{
attributeValues.Add(string.Format("{0}=\"{1}\"", entry.Key, entry.Value));
}
}
if (0 != attributeValues.Count)
{
Output.Write(" ");
Output.Write(string.Join(" ", attributeValues.ToArray()));
}
Output.Write(">");
if (block != null)
{
block.Call(null);
}
Output.Write("</{0}>", tag);
}
示例2: Call
public int Call(ICallable callable, double salience, object value, IContinuation succ, IFailure fail)
{
if (callable is IAgent)
((IAgent)callable).Initialize(this, salience);
if (salience > 0)
return callable.Call(value, succ, fail);
return 1;
}
示例3: BlockTag
private void BlockTag(string tag, IDictionary attributes, ICallable block)
{
writer.WriteStartElement(tag);
if (null != attributes)
{
foreach(DictionaryEntry entry in attributes)
{
writer.WriteAttributeString((string) entry.Key, (string) entry.Value);
}
}
if (block != null)
{
block.Call(null);
}
writer.WriteEndElement();
}
示例4: map
public static IEnumerable map(object enumerable, ICallable function)
{
if (null == enumerable) throw new ArgumentNullException("enumerable");
if (null == function) throw new ArgumentNullException("function");
object[] args = new object[1];
foreach (object item in iterator(enumerable))
{
args[0] = item;
yield return function.Call(args);
}
}
示例5: Call
/// <summary> Call {@link
/// Callable#call(Context cx, Scriptable scope, Scriptable thisObj,
/// Object[] args)}
/// using the Context instance associated with the current thread.
/// If no Context is associated with the thread, then
/// {@link ContextFactory#makeContext()} will be called to construct
/// new Context instance. The instance will be temporary associated
/// with the thread during call to {@link ContextAction#run(Context)}.
/// <p>
/// It is allowed to use null for <tt>factory</tt> argument
/// in which case the factory associated with the scope will be
/// used to create new context instances.
///
/// </summary>
public static object Call(ContextFactory factory, ICallable callable, IScriptable scope, IScriptable thisObj, object [] args)
{
if (factory == null) {
factory = ContextFactory.Global;
}
Context cx = CurrentContext;
if (cx != null) {
object result;
if (cx.factory != null) {
result = callable.Call (cx, scope, thisObj, args);
}
else {
// Context was associated with the thread via Context.enter,
// set factory to make Context.enter/exit to be no-op
// during call
cx.factory = factory;
try {
result = callable.Call (cx, scope, thisObj, args);
}
finally {
cx.factory = null;
}
}
return result;
}
cx = PrepareNewContext (AppDomain.CurrentDomain, factory);
try {
return callable.Call (cx, scope, thisObj, args);
}
finally {
ReleaseContext (cx);
}
}
示例6: callSpecial
public static object callSpecial(Context cx, ICallable fun, IScriptable thisObj, object [] args, IScriptable scope, IScriptable callerThis, int callType, string filename, int lineNumber)
{
if (callType == Node.SPECIALCALL_EVAL) {
if (BuiltinGlobal.isEvalFunction (fun)) {
return evalSpecial (cx, scope, callerThis, args, filename, lineNumber);
}
}
else if (callType == Node.SPECIALCALL_WITH) {
if (BuiltinWith.IsWithFunction (fun)) {
throw Context.ReportRuntimeErrorById ("msg.only.from.new", "With");
}
}
else {
throw Context.CodeBug ();
}
return fun.Call (cx, scope, thisObj, args);
}
示例7: ForEach
public static void ForEach(Context ctx, IEnumerable<object> set, ICallable func)
{
foreach (var obj in set)
{
func.Call(ctx.GameState, ctx, new[] { obj });
}
}
示例8: DoTopCall
/// <summary> Execute top call to script or function.
/// When the runtime is about to execute a script or function that will
/// create the first stack frame with scriptable code, it calls this method
/// to perform the real call. In this way execution of any script
/// happens inside this function.
/// </summary>
protected internal virtual object DoTopCall(ICallable callable, Context cx, IScriptable scope, IScriptable thisObj, object [] args)
{
return callable.Call (cx, scope, thisObj, args);
}