本文整理汇总了C#中ICallable类的典型用法代码示例。如果您正苦于以下问题:C# ICallable类的具体用法?C# ICallable怎么用?C# ICallable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ICallable类属于命名空间,在下文中一共展示了ICallable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: CallableAsEvaluable
public CallableAsEvaluable(ICallable callable, object value, IContinuation succ, IFailure fail)
{
this.callable = callable;
this.value = value;
this.succ = succ;
this.fail = fail;
}
示例3: Submit
/// <summary>提交一个线程等待执行
/// </summary>
/// <param name="callable">The callable.</param>
/// <param name="state">The state.</param>
public static void Submit(ICallable callable, object state)
{
if (!callable.IsRunning)
{
ThreadPool.QueueUserWorkItem(new WaitCallback(callable.Call), state);
}
}
示例4: Invoke
public object Invoke(ICallable method, object[] parameters)
{
if (this.host == null)
this.host = Machine.Current.GetHost(this.HostId);
return this.host.Invoke(this, method, parameters);
}
示例5: 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;
}
示例6: BrailViewComponentContext
/// <summary>
/// Initializes a new instance of the <see cref="BrailViewComponentContext"/> class.
/// </summary>
/// <param name="parent">The parent.</param>
/// <param name="body">The body.</param>
/// <param name="name">The name.</param>
/// <param name="text">The text.</param>
/// <param name="parameters">The parameters.</param>
public BrailViewComponentContext(BrailBase parent, ICallable body,
string name, TextWriter text, IDictionary parameters)
{
this.parent = parent;
this.body = body;
componentName = name;
default_writer = text;
componentParameters = parameters;
}
示例7: BrailViewComponentContext
/// <summary>
/// Initializes a new instance of the <see cref="BrailViewComponentContext"/> class.
/// </summary>
/// <param name="parent">The parent.</param>
/// <param name="body">The body.</param>
/// <param name="name">The name.</param>
/// <param name="text">The text.</param>
/// <param name="parameters">The parameters.</param>
public BrailViewComponentContext(BrailBase parent, ICallable body,
string name, TextWriter text, IDictionary parameters)
{
this.parent = parent;
this.body = body;
componentName = name;
default_writer = text;
componentParameters = IgnoreNull.ReplaceIgnoreNullsWithTargets(parameters);
}
示例8: AbstractInvocation
public AbstractInvocation( ICallable callable, object proxy, MethodInfo method, object newtarget )
{
this.callable = callable;
this.proxy = proxy;
this.target = callable.Target;
if (newtarget != null)
{
this.target = newtarget;
}
this.method = method;
}
示例9: Iterator
public Iterator(IEnvironment environment, IDynamic iterable)
{
_environment = environment;
var o = iterable.ConvertToObject();
var createIterator = o.Get("createIterator") as ICallable;
if (createIterator == null)
throw environment.CreateTypeError("The object supplied does not contain a callable property named 'createIterator'.");
_iterator = createIterator.Call(environment, iterable, environment.EmptyArgs).ConvertToObject();
if (!_iterator.HasProperty("current"))
throw environment.CreateTypeError("The object returned from the iterable supplied does not have a property named 'current'.");
_next = _iterator.Get("next") as ICallable;
if (_next == null)
throw environment.CreateTypeError("The object returned from the iterable supplied does not have a callable property named 'next'.");
}
示例10: Add
/// <summary>
/// Adds the given function to the symbol table.
/// </summary>
public void Add(ICallable callable)
{
// match against the unique name
var uniqueName = callable.UniqueName();
//### bob: if we want users to be able to override intrinsics, we may need to handle this differently
if (mCallables.ContainsKey(uniqueName)) throw new CompileException("A function named " + uniqueName + " has already been declared.");
mCallables.Add(uniqueName, callable);
// if there is an inferrable name, also include the name without the type arguments
if (callable.HasInferrableTypeArguments)
{
mCallables.Add(callable.UniqueInferredName(), callable);
}
}
示例11: CallResult
public static object CallResult(ICallable callable, object value, int maxtime, double exitscore)
{
QueueArena arena = new QueueArena();
BestContinuation getbest = new BestContinuation();
LastFailure getlast = new LastFailure();
arena.Call(callable, 100.0, value, getbest.GetContinue(), getlast.GetFail());
while (maxtime > 0 && getbest.Salience <= exitscore && !arena.IsEmpty)
maxtime -= arena.EvaluateOne();
if (getbest.Value == null && getlast.Reason != null)
return new Exception(getlast.Reason);
return getbest.Value;
}
示例12: 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();
}
示例13: RegisterSection
public void RegisterSection(string name, ICallable section)
{
if (sections == null)
{
sections = new Hashtable(StringComparer.InvariantCultureIgnoreCase);
}
sections[name] = section;
}
示例14: TryFind
private bool TryFind(string name, IEnumerable<IBoundDecl> typeArguments, IBoundDecl paramType, out ICallable bound)
{
string uniqueName = Callable.UniqueName(name, typeArguments, paramType);
// look up by unique name
if (mCallables.TryGetValue(uniqueName, out bound)) return true;
// wasn't found
return false;
}
示例15: Tag
public void Tag(string name, IDictionary attributes, ICallable block)
{
BlockTag(name, attributes, block);
}