Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_components thread: Property parameters as Variant


Message #1 by "J House" <jesse@s...> on Fri, 29 Jun 2001 20:47:45
I have a component for use with ASP only.



In your opinion, which of these is better a way to send arguments

ByVal vData As Integer or ByVal vData As Variant.



Public Property Let EndYear(ByVal vData As Integer)

    mEndYear = vData

End Property

***********************

or

Public Property Let EndYear(ByVal vData As Variant)

    mEndYear = vData

End Property

***********************

From an asp programmers perspective it is easier not to have force the 

data type.

myObject.EndYear = Cint(intEndYear) vs. myObject.EndYear = intEndYear

but is there a performance price to pay by using the Variant type as an 

argument of every Property Let function?



Message #2 by "Gerhard Wentink" <data@w...> on Sat, 30 Jun 2001 08:53:03 -0700
Best practice is to always use the correct datatype. A variant can hold any

of the other types and uses therefore at least 16 bytes of memory.

An integer only uses 2 bytes.

But then: the name of your variable suggests it is a Date, in that case I

would use the Date datatype (8 bytes).

Regards,



Gerhard Wentink



----- Original Message -----

From: "J House" <jesse@s...>

To: "ASP components" <asp_components@p...>

Sent: Friday, June 29, 2001 8:47 PM

Subject: [asp_components] Property parameters as Variant





> I have a component for use with ASP only.

>

> In your opinion, which of these is better a way to send arguments

> ByVal vData As Integer or ByVal vData As Variant.

>

> Public Property Let EndYear(ByVal vData As Integer)

>     mEndYear = vData

> End Property

> ***********************

> or

> Public Property Let EndYear(ByVal vData As Variant)

>     mEndYear = vData

> End Property

> ***********************

> From an asp programmers perspective it is easier not to have force the

> data type.

> myObject.EndYear = Cint(intEndYear) vs. myObject.EndYear = intEndYear

> but is there a performance price to pay by using the Variant type as an

> argument of every Property Let function?

>

>




  Return to Index