我通过我的申请向我的客户发送短信.假设如果向100个手机号码发送消息,则其中一个恰好是不存在的手机号码.我怎样才能单独跳过这个号码并发送其余的号码?当消息无法传递时,我在方法中使用try catch块,它会捕获并且无法发送其余的数字.有什么想法可以做到这一点?
听起来像是在使用这样的东西:
try {
foreach(string number in numbers) {
// send sms here
}
}
catch()
{
// do error handling here
}
Run Code Online (Sandbox Code Playgroud)
像这样做:
foreach(string number in numbers) {
try {
// send sms here
}
catch() {
// do error handling here
}
}
Run Code Online (Sandbox Code Playgroud)