本文整理汇总了C#中Func.notNull方法的典型用法代码示例。如果您正苦于以下问题:C# Func.notNull方法的具体用法?C# Func.notNull怎么用?C# Func.notNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Func
的用法示例。
在下文中一共展示了Func.notNull方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: cacheGet
public string cacheGet(string itemPath, string cacheSaveExtension, Func<string> getFunction)
{
if (DisableCache)
return getFunction();
var cacheAddress = getCacheAddress(itemPath,cacheSaveExtension);
if (cacheAddress.fileExists())
{
"[FileCache] returning data from local cache: {0}".debug(cacheAddress);
return cacheAddress.fileContents();
}
else if (getFunction.notNull())
{
var result = getFunction();
if (result.valid())
{
result.saveAs(cacheAddress);
return result;
}
else
"[FileCache] getFunction returned not data".error();
}
return "";
}
示例2: createAllMethodsStreams
public static string createAllMethodsStreams(this O2MappedAstData astData, string targetFolder, ProgressBar TopProgressBar, Func<string,bool> statusMessage)
{
var iMethods = astData.iMethods(astData.methodDeclarations());
TopProgressBar.maximum(iMethods.size());
int count = 0;
int total = iMethods.size();
//this.MethodStreams = new Dictionary<IMethod, string>();
foreach(var iMethod in iMethods)
{
TopProgressBar.increment(1);
astData.createO2MethodStreamFile(iMethod,targetFolder);
//MethodStreams.Add(iMethod,AstData.createO2MethodStream(iMethod).csharpCode());
if (statusMessage.notNull())
if (statusMessage("calculating methodStream: {0}/{1}".format(count++, total)).isFalse())
{
"Scan Cancel/Stop request received".info();
return targetFolder;
}
}
return targetFolder;
}
示例3: checkSecurityMappings
//helper methods
public void checkSecurityMappings(Allowed_User allowedUser, Func<Test_User> loginFunction)
{
Action loginUser = ()=>
{
if (loginFunction.notNull()) // we need to login before each invocation since there are GET and POST calls that reset the current user
{
Assert.NotNull(loginFunction.invoke().notNull());
}
};
loginUser();
checkSecurityMappings(allowedUser, SecurityMappings_GET, getResult_GET);
loginUser();
checkSecurityMappings(allowedUser, SecurityMappings_POST, getResult_POST);
loginUser();
checkSecurityMappings(allowedUser, SecurityMappings_PUT, getResult_PUT);
}