我创建了一个以列表为参数的对象,但是当我将列表传递给执行对象时,出现错误。请指导,代码如下
object myobj {
private var dateList = List[String]()
private val NPARAMS = 1
private def parseArgs(args:Array[String]):Unit ={
if(args.length < NPARAMS){
println("Insufficient No of Parameters")
System.exit(1)
}
var i = 0
dateList = List(args(i))
}
// Some code...
}
正在执行对象
val dateList = ("2019-01-01","2019-01-02")
myobj.main(Array(dateList))
错误
dateList: (String, String) = (2019-01-01,2019-01-02)
<console>:37: error: type mismatch;
found : (String, String)
required: String
myobj.main(Array(dateList))
^
答案 0 :(得分:2)
您的变量dateList
是一个元组。在scala中,错误消息中的符号(TypeA,TypeB)是scala.Tuple2 [TypeA,TypeB]的简写。
您想要的是一个数组Array("arg1", "arg2")
。
答案 1 :(得分:1)
你是说
Outlook.Application app = new Outlook.Application();
RDOSession session = new RDOSession();
session.MAPIOBJECT = app.Session.MAPIOBJECT;
RDOFolder inbox = session.GetDefaultFolder(rdoDefaultFolders.olFolderInbox);
RDOItems items = inbox.Items;
RDOMail mail = items.GetFirst();
if (mail.MessageClass == "IPM.Note.SMIME") {
RDOEncryptedMessage encryptedMessage = (RDOEncryptedMessage)session.GetMessageFromID(mail.EntryID)
// from here I am stuck because encryptedMessage is null
}
?