我得到了該行的代碼,它是越來越重複了很多你會如何改寫這行代碼,以便更爲通用
myString = If(myObj1.myProp Is Nothing, "", If(want = "abr", myObj1.myProp.abr, myObj1.myProp.desc))
該行x ñ,只是改變「myObj1」到「 什麼 「和」 myProp 「到」 什麼「
我想這
Public Function getDesc(Of t)(ByVal obj As t) As String
Return If(obj Is Nothing, "", If(want = "abr", obj.abr, obj.Desc))
End Function
這裏的問題是牛逼不知道它有ABR/遞減性能
你能解釋一點myProp,want,abr和desc是什麼? myProp和Prefix之間有任何關係嗎? –
@ Meta-Knight,修復了我的示例代碼 – Fredou