interest 1// Create DataSet 2 DataSet ds =new DataSet("ds"); 3 DataTable dt = ds.Tables.Add("dt"); 4 dt.Columns.Add("Value", typeof(int)); 5 6// Add two rows, both with Value column set to 1 7 DataRow row1 = dt.NewRow(); row1["Value"] =1; dt.Rows.Add(row1); 8 DataRow row2 = dt.NewRow(); row2["Value"] =1; dt.Rows.Add(row2); 9 Assert.IsFalse(row1["Value"] == row2["Value"]);//The reason is that both row1[Value] and row2[Value] return objects, not integers 10// Compare with == returns false. 11 Assert.IsTrue(row1["Value"].Equals(row2["Value"]));//This is because .Equals is overridden in System.Int32 to do a value comparison 12// Compare with .Equals returns true.
String is especial 1object a ="Hello World"; 2object b ="Hello World"; 3 Assert.IsTrue(a.Equals(b)); 4 Assert.IsTrue(a == b);//because of an optimization in the CLR. The CLR keeps a list of all strings currently being used in an application in something called the intern pool. When a new string is set up in code the CLR checks the intern pool to see if the string is already in use. If so, it will not allocate memory to the string again, but will re-use the existing memory. Hence a == b is true above 5 6object a1 ="Hello World"; 7object b1 =new StringBuilder().Append("Hello").Append(" World").ToString(); 8 Assert.IsTrue(a1.Equals(b1)); 9 Assert.IsFalse(a1 == b1);//a and b do not have the same adrress.
视图控制层代码demo如下:
@Controller
@RequestMapping("/")
public class MessageController {
private final MessageRepository messageRepository;
@Autowired
public MessageController(Mes
作为一名
Linux SA,日常运维中很多地方都会用到脚本,而服务器的ip一般采用静态ip或者MAC绑定,当然后者比较操作起来相对繁琐,而前者我们可以设置主机名、ip信息、网关等配置。修改成特定的主机名在维护和管理方面也比较方便。如下脚本用途为:修改ip和主机名等相关信息,可以根据实际需求修改,举一反三!
#!/bin/sh
#auto Change ip netmask ga