0

以下是 Microsoft Dynamics CRM 2011 SDK 中 CRUDOperations.vb 文件中的一些代码:

  ' Retrieve the account containing several of its attributes.
  Dim cols As New ColumnSet(New String() { "name", "address1_postalcode", "lastusedincampaign" })
  Dim retrievedAccount As Account = CType(_service.Retrieve("account", _accountId, cols), Account)
  Console.Write("retrieved, ")
  ' Update the postal code attribute.
  retrievedAccount.Address1_PostalCode = "98052"
  ' The address 2 postal code was set accidentally, so set it to null.
  retrievedAccount.Address2_PostalCode = Nothing

现在,如果我理解正确,以下行:

      Dim retrievedAccount As Account = CType(_service.Retrieve("account", _accountId, cols), Account)

好像真的什么都没做?

4

1 回答 1

4
  1. 它调用_service.Retrieve("account", _accountId, cols)
  2. 它将返回值转换为 type Account
  3. 它将返回值存储在变量中retrievedAccount

然后后面的几行修改了被引用的账户的属性retrievedAccount

于 2012-10-18T18:43:41.600 回答