Reputation: 45
I have an object Shift with a property DateAndTime as Date. When I try to set this property using Now() the VS debugger pops up an error
System.TypeLoadException: 'Could not resolve type with token 0100006b from typeref (expected class 'Microsoft.VisualBasic.DateAndTime' in assembly 'Microsoft.VisualBasic, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')'
If I hard code a date e.g. #2022-12-25 3:10 PM# all is fine. What does Xamarin expect?
Upvotes: 1
Views: 75
Reputation: 54427
You shouldn't really be using those in any VB code, never mind a Xamarin app. Don't use VB Runtime functions (methods from modules in the Microsoft.VisualBasic
namespace) when there are equivalent or better options that are not VB-specific. In this case, use the Date.Now
and Date.Today
properties, exactly as any C# developer would.
Note that Date
is a VB data type that maps to the .NET DateTime
structure. You can use either in your code but, if you use Integer
rather than Int32
then you should be using Date
rather than DateTime
too.
Upvotes: 3