如何在vb.net中使用`Me` With ... End With块 [英] How to use `Me` in vb.net With...End With block
本文介绍了如何在vb.net中使用`Me` With ... End With块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用此代码"VB.Net 2005"
With this code "VB.Net 2005"
Dim dep as new Department
With dep.AddNewEmployee()
.FirstName = "Mr. A"
.LastName = "B"
If TypeOf {dep.AddNewEmployee()'s instance} is Serializable then
'Do something
End If
end With
该代码有任何语法. in 有可能吗? 无法使用 There is no way to do that by using the 这篇关于如何在vb.net中使用`Me` With ... End With块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!{dep.AddNewEmployee()'s instance}
is there any syntax for this code.推荐答案
With
语法来做到这一点.您可以只添加引用新对象的局部变量:With
syntax. You could just add a local variable that references the new object though:Dim dep as new Department
Dim emp = dep.AddNewEmployee()
With emp
.FirstName = "Mr. A"
.LastName = "B"
If emp.GetType().IsSerializable Then
'Do something
End If
end With
查看全文