error message with get set with timer

rick ruhl 61 Reputation points
2021-12-03T20:58:34.797+00:00

Getting this error message with this code and I cant find anytime that make sense to fix it

1> D:\mdev\dealerpreviews\dealerpreviews\dealerpreviews\cuttingroom.xaml.cs(83,19,83,22): error CS0305: Using the generic type 'Set<TElement>' requires 1 type arguments
1> D:\mdev\dealerpreviews\dealerpreviews\dealerpreviews\cuttingroom.xaml.cs(89,19,89,22): error CS0305: Using the generic type 'Set<TElement>' requires 1 type arguments
1> D:\mdev\dealerpreviews\dealerpreviews\dealerpreviews\cuttingroom.xaml.cs(95,19,95,22): error CS0305: Using the generic type 'Set<TElement>' requires 1 type arguments

the code is

   private Timer _timer;
        private TimeSpan _totalSeconds;
        private string _time;
        private string _time2;

        public TimeSpan TotalSeconds
        {
            get { return _totalSeconds; }
            set { Set( ref _totalSeconds, value); }
        }

        public string Time
        {
            get { return _time; }
            set { Set(ref _time, value); }
        }

        public string Time2
        {
            get { return _time2; }
            set { Set(ref _time2, value); }
        }
Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,297 questions
{count} votes

1 answer

Sort by: Most helpful
  1. rick ruhl 61 Reputation points
    2021-12-04T18:05:14.593+00:00

    nope, same error message

     public partial class cuttingroom : ContentPage
        {
    
            private Timer _timer;
            private TimeSpan _totalSeconds;
            private string _time;
            private string _time2;
    
            public TimeSpan TotalSeconds
            {
                get { return _totalSeconds; }
                set { Set( ref _totalSeconds, value); }
            }
    
            public string Time
            {
                get { return _time; }
                set { Set(ref _time, value); }
            }
    
            public string Time2
            {
                get { return _time2; }
                set { Set(ref _time2, value); }
            }
    
    
    
    
    
    
            public enum CameraCaptureMode
            {
                Default,
                Photo,
                Video
            }
    
    
            public enum CameraFlashMode
            {
                Off,
                On,
                Auto,
                Torch
            }
    
            employeedatadata EmpData = new employeedatadata();
    
            private string uRL;
            private string returnuRL;
            private string timeoffilm;
            string videobase64;
            public Command<object> CaptureCommand { get; }
    
            public abstract class ContentPage : System.ComponentModel.INotifyPropertyChanged
            {
                /// <summary>
                /// Multicast event for property change notifications.
                /// </summary>
                public event PropertyChangedEventHandler PropertyChanged;
                /// <summary>
                /// Checks if a property already matches the desired value.  Sets the property and
                /// notifies listeners only when necessary.
                /// </summary>
                /// <typeparam name="T">Type of the property.</typeparam>
                /// <param name="storage">Reference to a property with both getter and setter.</param>
                /// <param name="value">Desired value for the property.</param>
                /// <param name="propertyName">Name of the property used to notify listeners.This
                /// value is optional and can be provided automatically when invoked from compilers that
                /// support CallerMemberName.</param>
                /// <returns>True if the value was changed, false if the existing value matched the
                /// desired value.</returns>
                protected virtual bool Set<T>(ref T storage, T value, [System.Runtime.CompilerServices.CallerMemberName] string propertyName = null)
                {
                    if (object.Equals(storage, value)) return false;
                    storage = value;
                    // Log.DebugFormat("{0}.{1} = {2}", this.GetType().Name, propertyName, storage);
                    this.OnPropertyChanged(propertyName);
                    return true;
                }
                /// <summary>
                /// Notifies listeners that a property value has changed.
                /// </summary>
                /// <param name="propertyName">Name of the property used to notify listeners.  This
                /// value is optional and can be provided automatically when invoked from compilers
                /// that support <see cref="CallerMemberNameAttribute"/>.</param>
                protected virtual void OnPropertyChanged([System.Runtime.CompilerServices.CallerMemberName] string propertyName = null)
                {
                    var eventHandler = this.PropertyChanged;
                    if (eventHandler != null)
                        eventHandler(this, new PropertyChangedEventArgs(propertyName));
                }
            }