本文整理汇总了C#中PathString.StartsWithSegments方法的典型用法代码示例。如果您正苦于以下问题:C# PathString.StartsWithSegments方法的具体用法?C# PathString.StartsWithSegments怎么用?C# PathString.StartsWithSegments使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PathString
的用法示例。
在下文中一共展示了PathString.StartsWithSegments方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetCommandName
public string GetCommandName(IDictionary<string, object> environment)
{
var request = new OwinRequest(environment);
var commandEndpointPath = (PathString) environment["CommandEndpointPath"];
var requestPath = new PathString(request.Uri.LocalPath);
PathString remainingPath;
if (requestPath.StartsWithSegments(commandEndpointPath, out remainingPath))
{
var commandName = remainingPath.Value.TrimStart('/');
return commandName;
}
return null;
}
示例2: GetCommandName
public string GetCommandName()
{
var environment = OwinRequestScopeContext.Current.Environment;
var request = new OwinRequest(environment);
var commandEndpointPath = (PathString) environment["CommandEndpointPath"];
var requestPath = new PathString(request.Uri.LocalPath);
PathString remainingPath;
if (requestPath.StartsWithSegments(commandEndpointPath, out remainingPath))
{
var commandName = remainingPath.Value.TrimStart('/');
return commandName;
}
return null;
}
示例3: StartsWithSegmentsWithRemainder_DoesMatchUsingSpecifiedComparison
public void StartsWithSegmentsWithRemainder_DoesMatchUsingSpecifiedComparison(string sourcePath, string testPath, StringComparison comparison, bool expectedResult)
{
var source = new PathString(sourcePath);
var test = new PathString(testPath);
PathString remaining;
var result = source.StartsWithSegments(test, comparison, out remaining);
Assert.Equal(expectedResult, result);
}
示例4: StartsWithPerformsIgnoreCaseLeadingPathMatch
public void StartsWithPerformsIgnoreCaseLeadingPathMatch(
string pathValue,
string matchValue,
bool startsWith,
string remainingValue)
{
var path = new PathString(pathValue);
var match = new PathString(matchValue);
path.StartsWithSegments(match).ShouldBe(startsWith);
PathString remaining;
path.StartsWithSegments(match, out remaining).ShouldBe(startsWith);
if (startsWith)
{
remaining.Value.ShouldBe(remainingValue);
}
else
{
remaining.ShouldBe(PathString.Empty);
remaining.ShouldBe(new PathString(String.Empty));
remaining.Value.ShouldBe(String.Empty);
remaining.HasValue.ShouldBe(false);
}
}
示例5: StartsWithSegments_DoesACaseInsensitiveMatch
public void StartsWithSegments_DoesACaseInsensitiveMatch(string sourcePath, string testPath, bool expectedResult)
{
var source = new PathString(sourcePath);
var test = new PathString(testPath);
var result = source.StartsWithSegments(test);
Assert.Equal(expectedResult, result);
}