Chapter 12: Customizing the Development Environment

363

You’ve now recorded a macro. To check the preceding steps against what you’ve produced, here’s a revised AddNewCustomer method, showing what the results should look like:

C#:

using System;

class Customer

{

public int AddNewCustomer(string firstName, string lastName)

{

if (string.IsNullOrWhiteSpace(firstName))

{

throw new ArgumentNullException( "firstName",

"firstName value is not valid.");

}

int newCustID = 0;

//Logic to add customer return newCustID;

}

}

VB:

Public Class Customer

Function AddNewCustomer(

ByVal firstName As String,

ByVal lastName As String) As Integer

If String.IsNullOrWhiteSpace(firstName) Then

Throw New ArgumentNullException(

"firstName",

"firstName value is not valid.")

End If

Dim newCustID As Integer = 0

'Logic to add customer Return newCustID

End Function

End Class

Page 386
Image 386
Microsoft 9GD00001 manual 363