本文整理汇总了C#中System.Object.As方法的典型用法代码示例。如果您正苦于以下问题:C# Object.As方法的具体用法?C# Object.As怎么用?C# Object.As使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Object
的用法示例。
在下文中一共展示了Object.As方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: New
internal static PsRequest New(Object requestObject, PowerShellProviderBase provider, string methodName) {
if (requestObject is IAsyncAction) {
((IAsyncAction)(requestObject)).OnCancel += provider.CancelRequest;
((IAsyncAction)(requestObject)).OnAbort += provider.CancelRequest;
}
var req = requestObject.As<PsRequest>();
req.CommandInfo = provider.GetMethod(methodName);
if (req.CommandInfo == null) {
req.Debug("METHOD_NOT_IMPLEMENTED", methodName);
}
req._provider = provider;
if (req.Options == null) {
req.Debug("req.Options is null");
} else {
req.Debug("Calling New() : MethodName = '{0}'", methodName);
foreach(string key in req.Options.Keys)
{
req.Debug(String.Format(CultureInfo.CurrentCulture, "{0}: {1}", key, req.Options[key]));
}
}
return req;
}
示例2: New
internal static PsRequest New(Object requestObject, PowerShellProviderBase provider, string methodName)
{
if (requestObject is IAsyncAction) {
((IAsyncAction)(requestObject)).OnCancel += provider.CancelRequest;
((IAsyncAction)(requestObject)).OnAbort += provider.CancelRequest;
}
var req = requestObject.As<PsRequest>();
req.CommandInfo = provider.GetMethod(methodName);
if (req.CommandInfo == null) {
req.Debug("METHOD_NOT_IMPLEMENTED", methodName);
}
req._provider = provider;
return req;
}