我有一个简单的函数,它接受一个字符串并使用该字符串向我发送一封电子邮件(在调试实时网站时使用该函数)
public void errEmailV1(string strVars)
{
sendEmail("me@email","emailSubject",strVars);
}
当然要对函数进行校验并发送多个变量:
Functions funcs = new Functions();
funcs.errEmailV1(someVariableThatisAString+", "+someIntVariable.ToString() +"...");
我后来进化了我的功能,以便能够更快地调用它
Functions funcs = new Functions();
funcs.errEmailV2(someVariableThatisAString,someIntVariable.ToString());
public void errEmailV2(params String[] paths)
{
string strVars="";
//a rather simplified version of the loop:
for (int i = 0; i < paths.Length; i++)
{
strVars+= paths[i];
}
sendEmail("me@email","emailSubject",strVars);
}
我对此表示怀疑,但我的V3是否可以使用任意数量的字符串,整数和布尔值(我很少发送任何其他类型)而不必总是添加ToString()
?
答案 0 :(得分:3)
如何使用var express = require('express'),
cs = require("coffee-script/register"),
app = express(),
path = require('path'),
cookieParser = require('cookie-parser'),
session = require('express-session'),
config = require('./config/config.js'),
orientDBStore = require('connect-orientdb')(session),
OrientDB = require('orientjs'),
orientDBConfig = {
server : {
host: "localhost",
port:2424
},
db : {
user_name: "admin",
user_password: "admin"
},
database : "sessions",
class_name : "sessions_class"
},
server = OrientDB({
hose : "localhost",
port : "2424",
username : "root",
password : "root"
})
;
app.set('views', path.join(__dirname, 'views'));
app.engine('html', require('hogan-express'));
app.set('view engine', 'html');
app.use(express.static(path.join(__dirname,'public' )));
app.use(cookieParser());
require('./routes/route.js')(express, app);
app.use(session({
secret:"mySecret",
store: new orientDBStore(orientDBConfig)
}));
app.listen(8000, function () {
console.log("app is listening on port 8000");
})
和String.Join
:
params object[]