> How about:
>
> Const c1FaLen = Convert.ToString(c1FullAddr).Length ?

Because it doesn't work?

c1FullAddr already is a string; there's no need to convert it to a
string to call its Length property.
It doesn't help because you can't call methods/properties to set the
value of a Const.

> Can I ask in the interest of increasing my understanding - where does
> 'compile time' come into it?

It is the job of the compiler to work out the value of Consts, and it
(generally) cannot execute methods/properties of objects during the
compilation phase.

Peter's solution of using ReadOnly and John's(/your) solution of Dim
both solve the problem as calculating the value is deferred until the
value is first referenced (at run-time), when the run-time environment
can call methods/properties of other objects.

John

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to