Static needs memory if not used?

I have a method with a static variable:

[code]Public Function GUID() as String
static value as String

if Value="" then
Value = “…”
end if
End Function[/code]

Does the variable “value” consume memory when the method is not called for an instance/object?

So, when I put an extension method to object, and don’t want to use GUDI()-function for many objects,
is still memory wasted for every object instantiated? (I of course mean the additional memory for value)

Thanks a lot!

The value and the hidden variable to check status may take 8 to 16 bytes.

But the string is only created and kept when you assign it.

Great!
Thanks a lot for clarifying.

So, no inheritance needed in each class with a cross-concern.

I can extend Object by the method and it only consumes additionally the value’s memory when method is first called.

I need the GUID for a kind of a remote procedure call serialized with JSON.
And so, each instance (of not many instances) must have a unique key.

Thanks again!
Regards.

Static variables are shared between instances, so there will only be one value in your entire app. If you need each instance to have its own value, make it a property instead.

Well, good to know.
So, I will inherit then.
Not a big problem.

Thanks a lot for the info!