My intellisense is giving me the error: 'ClassLibrary1.GetTimeZone.myWorldTime' is a 'field' but is used like a 'type'
Any idea what I'm doing wrong?
!Object Browser for the class1
Can objects be fields too? @Ahmad No, a field can't be an "object". it can be a reference to an object.
To determine whether an object is a specific type, you can use your language's type comparison keyword or construct.
The object type is an alias for System. Object in . NET. In the unified type system of C#, all types, predefined and user-defined, reference types and value types, inherit directly or indirectly from System.
Classes are reference types that hold the object created dynamically in a heap. All classes have a base type of System. Object. The default access modifier of a class is Internal.
You need to put the line in error in a class constructor or a method.
LoadData
is a static method. You call it on the type, not an instance.
ChaosSoftware.WorldTime.LoadData("worldtime.xml");
This needs to be placed inside a method in order to execute (constructor or other method).
Additionally, though not the reason for the error, you should use "
to delimit a string. In C#, single quotes are for character literals (that is, single characters). What you have will not compile.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With