问题
从下面的项目列表我将需要通过识别具有给定值的键范围来访问该项目,例如,假设值为2.1.1,这是度,分和秒我需要找到键0.0.0-30.0.0性能是高优先级.
key: 0.0.0-30.0.0 value: x-y-z
key: 30.0.0-60.0.0 value: y-x-z
key: 60.0.0-90.0.0 value: z-y-z
Run Code Online (Sandbox Code Playgroud)
解决方案1: 到目前为止我尝试过以下解决方案
重新创建新的键/值(json)文件,如下所示
key: 0.0.0 value: x-y-z
key: 0.0.1 value: x-y-z
.
key: 0.0.59 value: x-y-z
.
key: 0.1.0 value x-y-z
key: 0.1.1 value x-y-z
key: 30.0.0 value: y-x-z
.
.
key: 30.0.59 value: y-x-z
.
key: 30.1.0 value: y-x-z
key: 30.1.1 value: y-x-z
key: 30.1.2 value: y-x-z
.
.
key: 30.1.59 value: y-x-z
key: 30.2.0 value: y-x-z
key: 30.2.1 value: y-x-z
key: 30-2.3 value: y-x-z …
Run Code Online (Sandbox Code Playgroud) 我在剃刀视图中有如下代码
<a href="@Url.Action("Details", "Mycontr", new {id =16}, Request.Url.Scheme)">
Run Code Online (Sandbox Code Playgroud)
当我双击这个项目时,它被重定向到Url下面
http://localhost:49280/Mycontr/Section/@Url.Action(
Run Code Online (Sandbox Code Playgroud)
但是预期的却是
http://localhost:49280/Mycontr/Details/16
Run Code Online (Sandbox Code Playgroud)
以下是RouteConfig
routes.MapRoute(
name: "Capsule",
url: "Mycontr/Details/{id}",
defaults: new { controller = "Mycontr", action = "Details", id = UrlParameter.Optional }
);
routes.MapRoute(
name: "Section",
url: "Mycontr/Section/{id}",
defaults: new { controller = "Mycontr", action = "Section", id = UrlParameter.Optional }
);
Run Code Online (Sandbox Code Playgroud)
请建议.
我缩小了这个问题.Html.Raw导致问题.我有像这样的代码
@Html.Raw(HttpUtility.HtmlDecode(Model.sContent))
Run Code Online (Sandbox Code Playgroud)
该变量包含生成的具有Ur.Action的html.如果我只是直接将html生成的代码放在razor视图中而不使用Html.Raw它工作正常.但是,如果我拿出Html.Raw运行时生成的html脚本显示为
<style type='text/css'></style><center><div style="width:460px;"><div style="width: 460px; float: left;"><div s...
Run Code Online (Sandbox Code Playgroud)
有没有一种方法可以在不使用Html.Raw编码的情况下在变量中显示html脚本?通过使用HtmlString代替字符串变量来保存生成的Html脚本,解决了一半问题,但HtmlString无法解码字符串中的@ Url.Action语法.
以下是我一直在努力使其发挥作用的最新代码.请帮忙.
string templFile = string.Format("{0}\\DivTemplate.htm", path);
HtmlDocument divDoc = new HtmlDocument();
StreamReader sRdr = new …
Run Code Online (Sandbox Code Playgroud) 我的剃须刀视图中有一个代码,如下所示.鼠标悬停在任何锚标记上时,指针光标不显示.相同的代码在IE 9上运行正常.在Chrome浏览器上观察到此问题.有人猜测为什么以下代码在Chrome版本25.0.1364.172 m上失败了?
<ul id="menu" class="menu">
<li><a href="#" style="cursor: pointer;">Top 10 Headlines</a>
</li>
<li><a href="#">Related Content</a>
</li>
</ul>
Run Code Online (Sandbox Code Playgroud) 我填写空白表单,其中每个空白的长度不一致我想用特殊代码替换这些库以符合业务逻辑,下面是格式是如何
It is raining ________ in the forest
The quick _______ dog jumps over ______________ fox
Run Code Online (Sandbox Code Playgroud)
我想重新格式化以上行,如下所示
It is raining [0] in the forest
The quick [0] dog jumps over [1] fox
Run Code Online (Sandbox Code Playgroud)
如上所述,每个空白的字符长度不一致,保持该情况想要在c#中使用正则表达式或不使用正则表达式编写可维护代码
例外
有些条目没有任何空格,在这种情况下应该按原样返回整个段落
蒂姆建议的代码很好,我的代码与蒂姆的答案如下.希望可以帮助别人
Dictionary<string, string> dctE = new Dictionary<string, string>();
Dictionary<string, string> dctT = new Dictionary<string, string>();
string jsonT = string.Empty, jsonH = string.Empty;
try
{
using (StreamReader r = new StreamReader(@"C:\samples\testmongo\testmongo\tamil1.txt"))
{
string langs = r.ReadToEnd();
var lines = langs.Split('\n');
for (int i = 1; i …
Run Code Online (Sandbox Code Playgroud) anchor ×1
asp.net-mvc ×1
c# ×1
cursor ×1
hashmap ×1
hashtable ×1
json ×1
razor ×1
url.action ×1