我有这样的枚举和财产.
public enum Type
{
Hourly = 1,
Salary = 2,
None = 3
};
public string EmployeeType
{
get
{
string type;
switch (employeeType)
{
case Type.Hourly:
type = "Hourly Employee";
break;
case Type.Salary:
type = "Salary Employee";
break;
default:
type = "None";
break;
}
return type;
}
// **EDIT:**
// Now I am trying to parse the string as enum Type.
// But Constructor still waits a string to set EmployeeType.
set
{
employeeType = (Type)Enum.Parse(typeof(Type), value);
} …Run Code Online (Sandbox Code Playgroud) 我的数据库中有以下表格,我无法更改或修改.我保持Log表格简单但LogDetail与我的数据库中的相同.
记录表
Id User Department Service Method
21 John Sales UserService GetUser
Run Code Online (Sandbox Code Playgroud)
LogDetail表
Id LogRef ParamName ParamValue
30 21 FirstName Adam
31 21 LastName Smith
32 21 Age 35
33 21 Gender M
Run Code Online (Sandbox Code Playgroud)
现在,我正在使用以下查询来搜索谁(Adam,Smith,35,M)
SELECT
L.*, D1.ParamName, D2.ParamName, D3.ParamName, D4.ParamName
FROM Log as L
INNER JOIN LogDetail as D1 on L.Id = D1.LogRef
INNER JOIN LogDetail as D2 on L.Id = D2.LogRef
INNER JOIN LogDetail as D3 on L.Id = D3.LogRef
INNER JOIN LogDetail as D4 …Run Code Online (Sandbox Code Playgroud) 我对 SQL SERVER 功能有一个简单的问题charindex。
DECLARE @VAR1 varchar
SET @VAR1 = 'abcdef'
PRINT CHARINDEX('c', @VAR1)
Run Code Online (Sandbox Code Playgroud)
上面的语句应该打印3但打印0。为什么?
// Hideously slow program! Can you spot the object creation?
Long sum = 0L;
for (long i = 0; i < Integer.MAX_VALUE; i++) {
sum += i;
}
end = System.currentTimeMillis();
System.out.println("Long sum took: " + (end - start) + " milliseconds");
long sum2 = 0L;
for (long i = 0; i < Integer.MAX_VALUE; i++) {
sum2 += i;
}
end = System.currentTimeMillis();
System.out.println("long sum took: " + (end - start) + " milliseconds");
Run Code Online (Sandbox Code Playgroud)
嗨,我正在阅读有效的Java,并且Item 6:Avoid creating unnecessary objects …
sql-server ×2
accessor ×1
autoboxing ×1
c# ×1
char ×1
get ×1
java ×1
join ×1
performance ×1
properties ×1
set ×1
sql ×1
variables ×1