本文整理汇总了C#中Maybe.Apply方法的典型用法代码示例。如果您正苦于以下问题:C# Maybe.Apply方法的具体用法?C# Maybe.Apply怎么用?C# Maybe.Apply使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Maybe
的用法示例。
在下文中一共展示了Maybe.Apply方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Apply_EmptyMaybeReturnsEmptyMaybe
public void Apply_EmptyMaybeReturnsEmptyMaybe()
{
Maybe<string> str = new Maybe<string>(null);
Maybe<object> obj = str.Apply(x=>(Object)x);
Assert.IsNotNull(obj);
Assert.IsFalse(obj.HasValue);
}
示例2: Apply_NullFunctionReturnsEmptyMaybe
public void Apply_NullFunctionReturnsEmptyMaybe()
{
Maybe<string> str = new Maybe<string>("abc");
Maybe<object> obj = str.Apply<object>(null);
Assert.IsNotNull(obj);
Assert.IsFalse(obj.HasValue);
}
示例3: Apply_NonEmptyMaybeReturnsNonEmptyMaybe
public void Apply_NonEmptyMaybeReturnsNonEmptyMaybe()
{
Maybe<string> str = new Maybe<string>("abc");
Maybe<string> obj = str.Apply(x => x + "123");
Assert.IsNotNull(obj);
Assert.IsTrue(obj.HasValue);
Assert.AreEqual("abc123", obj.Value);
}
示例4: ExecuteInternal
private string ExecuteInternal(Maybe<string> pipeIn)
{
StartProcess();
pipeIn.Apply(WriteToStandardIn);
var output = GetOutputAndWait();
CheckExitCode();
return output;
}