小编Sha*_*eKm的帖子

LINQ无视案例

我遵循LINQ声明:

(from o in Table where (o.Username == username && o.Password == password) select o).SingleOrDefault()
Run Code Online (Sandbox Code Playgroud)

这似乎忽略了Case.我如何确保"测试"!="测试"等等谢谢

.net linq asp.net-mvc

0
推荐指数
1
解决办法
348
查看次数

JQuery附加到父div

对于以下html:

<div class="section grouping">
    <div class="sectionControl">
        <div class="parent row errorOn">
            <div class="validGroupControl">
                <div class="row2 itemWrap clearfix">
                    <label>Login1 (adress e-mail)<span class="iconReq">&nbsp;</span>:</label>
                    <input type="text" class="text">
                </div>
                <div class="itemWrap clearfix">
                    <label>Input field1<span class="iconReq">&nbsp;</span>:</label>
                    <input type="password" class="text">
                </div>
                <a href="#" class="iconClose" onclick="$(this).closest('div.parent').remove();" title="remove">remove</a>
            </div>
        </div>
    </div>
    <div class="row addControl">
        <a href="#" class="button" onclick="$('div.sectionControl').append($('div.sectionControl div.parent:last').html());">Add</a>
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

我希望它执行以下操作:单击"添加"按钮将采取<div class="parent...">并附加到<div class="sectionControl">

几乎我想要它,所以当我点击添加按钮时,新的<div class="parent"将添加到上一个<div class="parent...">和右上方:

                     </div>
                     <div class="row addControl">
Run Code Online (Sandbox Code Playgroud)

当我尝试使用parent()时,如下所示:

alert($('div.sectionControl div.parent:last').parent().html())
Run Code Online (Sandbox Code Playgroud)

我得到重复.因此,而不是只添加一个我得到的原始+我刚刚添加的.我不知道如何处理这个问题.

谢谢

javascript jquery

0
推荐指数
1
解决办法
5854
查看次数

枚举所有组合的最佳方式

假设我按任何顺序列出以下列表:

S1 
R1 
R2 
S2
S3
Run Code Online (Sandbox Code Playgroud)

我需要创建一个LIST,其中每个"S"包含每个"R"组合

输出:

S1 => R1
S1 => R2
S2 => R1
S2 => R2
S3 => R1
S3 => R2
Run Code Online (Sandbox Code Playgroud)

实现这一目标的最佳方法是什么?谢谢

.net c#

0
推荐指数
1
解决办法
83
查看次数

C#将字符串解析为对象

对于以下文字:

Item 1:
student-pay
history 320.00
math 500.10 extra

Item 2:
history 220.00
math 200.10
Run Code Online (Sandbox Code Playgroud)

我想将此文本解析为Item类.有没有更有效的方法来做到这一点?

我有以下内容:

            var result = input.Split(
                new[] { "item", "Item" }, 
                StringSplitOptions.RemoveEmptyEntries);

            foreach (string item in result)
            {
                var lineItems = item.Split(
                    new[] { Environment.NewLine }, 
                    StringSplitOptions.RemoveEmptyEntries);

                foreach (var lineItem in lineItems.Skip(1)) // remove ":"
                {
                        // split line again
// check if numeric
                }
            }

public class Course
{
    public bool StudentPay { get; set; }

    public ICollection<CourseItem> JobItems { get; set; }
} …
Run Code Online (Sandbox Code Playgroud)

.net c#

-1
推荐指数
1
解决办法
1080
查看次数

标签 统计

.net ×3

c# ×2

asp.net-mvc ×1

javascript ×1

jquery ×1

linq ×1