Static Class Constants (VB 2005)
- From: "Michael D. Ober" <obermd.@.alum.mit.edu.nospam>
- Date: Thu, 8 Dec 2005 10:39:48 -0700
Is there any way to create a constant in a class that can be used both with
an instantiated object and without. For example:
dim ClassConst as string = myClass.ConstantString
dim myObj = new MyClass
ClassConst = myObj.ConstantString
Inside the class MyClass
Class MyClass
public const ConstantString = "Some Constant String"
End Class
In Beta 2, ConstantString was available in either of the above cases without
complaint. In the RTM version, I can't do both. I don't want to turn off
the warning as doing so may actually introduce another bug in my code later
because I didn't see the warning.
Thanks,
Mike.
.
- Follow-Ups:
- Re: Static Class Constants (VB 2005)
- From: Cor Ligthert [MVP]
- Re: Static Class Constants (VB 2005)
- From: m.posseth
- Re: Static Class Constants (VB 2005)
- From: Marina
- Re: Static Class Constants (VB 2005)
- Prev by Date: Re: accessing BIN files
- Next by Date: Re: Garbage collection
- Previous by thread: Re: accessing BIN files
- Next by thread: Re: Static Class Constants (VB 2005)
- Index(es):
Loading