小编Sau*_*jan的帖子

静态和密封的类差异

  1. 是否有任何类在静态类中实现?手段:

    static class ABC : Anyclass
    
    Run Code Online (Sandbox Code Playgroud)
  2. 是否有任何类可以在密封类和静态类中继承?
    手段:

    static class ABC : AClass {}
    
    Run Code Online (Sandbox Code Playgroud)

    sealed class ABC : AClass {}
    
    Run Code Online (Sandbox Code Playgroud)

我在某种程度上可能是错的吗?

.net c# oop static sealed

142
推荐指数
4
解决办法
8万
查看次数

使用bootstrap将搜索图标放在文本框附近

我在默认文本框中使用bootstrap占据列的全宽,我想将搜索图标放在文本框的末尾.

我的代码是这样的:

<div class="container">
    <div class="row">
        <div class="form-group col-lg-4">
            <label class="control-label">Name</label>
            <input id="txtName" class="form-control input-sm" />
            <span class="glyphicon glyphicon-search"></span> 
        </div>
        <div class="col-lg-4"></div>
        <div class="col-lg-4"></div>
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

我不想使用输入组.

请用css建议替代方法或备用html.

html css icons twitter-bootstrap twitter-bootstrap-3

39
推荐指数
1
解决办法
15万
查看次数

字符串不表现为引用类型

今天我学习了价值类型和参考类型.

我在下面的代码示例中有一个疑问:

class Program
{
    static void Main(string[] args)
    {
        StringBuilder sb = new StringBuilder();
        FunctionSB(sb);
        Console.WriteLine(sb); //sb updated

        customer c = new customer();
        FunctionClass(c);
        Console.WriteLine(c.s);//updated class value 

        String str = "";
        FuntionString(str);
        Console.WriteLine(str);//

    }

    private static void FunctionSB(StringBuilder sb)
    {
        sb.Append("sb updated");
    }

    private static void FunctionClass(customer c)
    {
        c.s = "updated class value ";
    }

    static void FuntionString(String str)
    {
        str = "updated value";
    }
}
class customer
{
    public string s;
}
Run Code Online (Sandbox Code Playgroud)

这里更新字符串构建器值和类成员变量值,但为什么FuntionString(str);不更新str值?(为什么不作为参考传递?)

c# pass-by-reference

7
推荐指数
1
解决办法
143
查看次数

带接口的访问修饰符

我是.net C#的新手.我正在学习接口.

  1. 我们可以使用带接口的访问修饰符,如果是,哪些是有效的?
  2. 默认情况下,接口是内部的?
  3. 我们可以在接口成员上使用访问修饰符,如果是,哪些是有效的?

c# interface

5
推荐指数
1
解决办法
3万
查看次数

lambda表达式如何共享局部变量?

我正在阅读lambda表达式,我已经看过这个例子,

例1:

static Func<int> Natural()
{
    int seed = 0;
    return () => seed++; // Returns a closure
}

static void Main()
{
    Func<int> natural = Natural();
    Console.WriteLine (natural()); // output : 0
    Console.WriteLine (natural()); // output : 1
}
Run Code Online (Sandbox Code Playgroud)

例2:

static Func<int> Natural()
{
    return() => { int seed = 0; return seed++; };
}

static void Main()
{
    Func<int> natural = Natural();
    Console.WriteLine (natural()); // output : 0
    Console.WriteLine (natural()); // output : 0
}
Run Code Online (Sandbox Code Playgroud)

我无法理解为什么第一个示例输出是0和1.

c#

3
推荐指数
2
解决办法
540
查看次数

如何在Bootstrap中的行之间应用连续边框?

在大型桌面中,四个div应该出现在一行中.在中等大小中,应该出现三个div,在小型设备中,两个div和移动设备中只有一个潜水应该出现在一行中.我实现了它.但是我需要所有的div都有边界,并且在两个连续的div之间应该有一个px间隙.

我添加了边框它工作正常,当我添加边距1px到div然后在大桌面时,第四个div将移动到下一行.我的Html代码是 -

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Basic Bootstrap Template</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" type="text/css" href="BootstrapFiles/css/bootstrap.min.css">
    <style type="text/css">
    .bgcolor{
        background-color:orange;
        }
        .divCustom{
                border:solid 1px black;
        }

    </style>
</head>
<body>
<div class="container">
    <div class="row">
        <div class="col-sm-6 col-md-4 col-lg-3 divCustom">
            Personal Information
            <div class="row">
                <div class="col-xs-12">
                    <label class="control-label" for="txtName">Name</label>
                    <input id="txtName" class="form-control" />
                </div>
            </div>
            <div class="row">
                <div class="col-xs-12">
                    <label class="control-label" for="txtDepartment">Department</label>
                    <input id="txtDepartment" class="form-control" />
                </div>
            </div>
        </div>

        <div class="col-sm-6 col-md-4 col-lg-3 divCustom">
        Physical Information
            <div class="row"> …
Run Code Online (Sandbox Code Playgroud)

twitter-bootstrap twitter-bootstrap-3

3
推荐指数
1
解决办法
2125
查看次数

按行号更新行

我有一张只有一列的桌子

id
--
1
2
3
5
5

我想将第4行的值更新为"4",因此所需的输出为:

id
--
1
2
3
4
5

我怎样才能做到这一点

sql t-sql sql-server sql-server-2008

2
推荐指数
1
解决办法
451
查看次数

$ http.get,$ http.post,$ http.put,$ http.delete $ http.head和$ http.jsonp之间的区别

我是角度js和web开发的新手.请帮我.

今天我读到角度js中的$ http,但我只知道get和post方法.

可以请任何人解释一下,我有什么区别$ http.get,$ http.post,$ http.put,$ http.delete $ http.head和$ http.jsonp

所有这些以及何时使用.

提前致谢.

angularjs angularjs-directive angularjs-scope

2
推荐指数
1
解决办法
1万
查看次数

为什么接口不像类一样?

我有几个关于接口的问题.

  1. 为什么我们不能将virtual关键字与Interfaces成员一起使用

  2. 为什么我们不能在接口的派生类中使用override关键字

  3. 假设

    interface Iface
    {
        void Func();
    }
    class Program : Iface
    {
        static void Main(string[] args)
        {
    
        }
        public void Func()
        {
            Console.WriteLine("In func");
        }
    }
    
    Run Code Online (Sandbox Code Playgroud)

    为什么我需要在接口(即Func()定义中)对派生类中的成员函数使用public?如果我不使用public关键字,则会导致编译时错误

  4. 我们可以在Interface中使用静态成员吗​​?

c# oop interface c#-3.0 c#-4.0

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

Bootstrap 3表响应无法在移动浏览器的fieldset中工作

我正在创建一个Web应用程序,发现如果我使用fieldset然后表响应,那么页面上的水平滚动就会出现(320*480)的分辨率.如果我删除了fieldset,那么它工作正常.

我想在他的页面中同时使用它们.

我也尝试将.table-responsive div放在一行> col-xs-12但是它没有帮助相同的水平滚动来.

<fieldset>
    <legend>Tester</legend>
    <div class="table-responsive">
      <table class="table">
        <thead>
          <tr>
            <th>#</th>
            <th>Table heading</th>
            <th>Table heading</th>
            <th>Table heading</th>
            <th>Table heading</th>
            <th>Table heading</th>
            <th>Table heading</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td>1</td>
            <td>Table cell</td>
            <td>Table cell</td>
            <td>Table cell</td>
            <td>Table cell</td>
            <td>Table cell</td>
            <td>Table cell</td>
          </tr>
        </tbody>
      </table>
    </div>
</fieldset>
Run Code Online (Sandbox Code Playgroud)

mobile-browser twitter-bootstrap twitter-bootstrap-3

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

函数重载如何节省内存

函数重载如何节省内存?

以下两种类型的函数定义有什么区别,应该使用哪一种?

1)

ADD(a,b)
ADD(a,b,c)
ADD(a,b,c,d)
Run Code Online (Sandbox Code Playgroud)

2)

AddTwoNumbers(a,b)
AddThreeNumbers(a,b,c)
AddFourNumbers(a,b,c,d)
Run Code Online (Sandbox Code Playgroud)

c# c++ oop c#-4.0

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