本文整理汇总了C#中XObject.Exports方法的典型用法代码示例。如果您正苦于以下问题:C# XObject.Exports方法的具体用法?C# XObject.Exports怎么用?C# XObject.Exports使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XObject
的用法示例。
在下文中一共展示了XObject.Exports方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EvaluationXsltContext
/// <summary>
/// Initializes a new instance.
/// </summary>
/// <param name="xml"></param>
/// <param name="evaluationContext"></param>
public EvaluationXsltContext(
XObject xml,
EvaluationContext evaluationContext)
: this(xml.Exports().GetExportedValue<IXsltContextFunctionProvider>(), xml, evaluationContext)
{
Contract.Requires<ArgumentNullException>(xml != null);
Contract.Requires<ArgumentNullException>(evaluationContext != null);
}
示例2: GetListener
/// <summary>
/// Gets the existing <see cref="InterfaceEventListener"/> registered on the target.
/// </summary>
/// <param name="dispatcher"></param>
/// <param name="eventType"></param>
/// <param name="capture"></param>
/// <param name="handler"></param>
/// <param name="interfaceType"></param>
/// <param name="methodInfo"></param>
/// <returns></returns>
public static InterfaceEventListener GetListener(EventTarget dispatcher, string eventType, bool capture, XObject handler, Type interfaceType, MethodInfo methodInfo)
{
Contract.Requires<ArgumentNullException>(dispatcher != null);
Contract.Requires<ArgumentNullException>(!string.IsNullOrWhiteSpace(eventType));
Contract.Requires<ArgumentNullException>(handler != null);
Contract.Requires<ArgumentNullException>(interfaceType != null);
Contract.Requires<ArgumentNullException>(methodInfo != null);
Contract.Requires<ArgumentException>(IsValidMethodInfo(methodInfo));
var host = handler.Exports().GetExportedValue<Func<Document>>()();
if (host == null)
throw new InvalidOperationException();
// find existing listener
var listener = Enumerable.Empty<EventListenerRegistration>()
.Concat(dispatcher.GetRegistrations())
.OfType<InterfaceEventListener>()
.Where(i => i.GetHandler(host) == handler)
.Where(i => i.InterfaceType == interfaceType)
.FirstOrDefault();
return listener;
}