BeardedManStudios.Network.BeardedMath.IsNumber C# (CSharp) Метод

IsNumber() публичный статический Метод

Used to determine if a specified object is a number type
public static IsNumber ( object obj ) : bool
obj object The object to evaluate if it is a number
Результат bool
		public static bool IsNumber(object obj)
		{
			return obj is sbyte
				|| obj is byte
				|| obj is short
				|| obj is ushort
				|| obj is int
				|| obj is uint
				|| obj is long
				|| obj is ulong
				|| obj is float
				|| obj is double
				|| obj is decimal;
		}
	}

Usage Example

Пример #1
0
		/// <summary>
		/// Create an instance NetRef
		/// </summary>
		/// <param name="getter">The getter function for the variable</param>
		/// <param name="setter">The setter function for the variable</param>
		/// <param name="callback">The optional callback to be executed when the replication has complete</param>
		/// <param name="callbackCallers">The group of callers that will execute the callback method</param>
		public NetRef(Func<T> getter, Action<T> setter, Action callback, NetworkCallers callbackCallers, bool ignoreInterpolation = false, bool serverOnly = false)
		{
			this.getter = getter;
			this.setter = setter;
			this.callback = callback;
			this.IgnoreLerp = ignoreInterpolation;
			this.callbackCallers = callbackCallers;
			this.serverOnly = serverOnly;

			this.IsNumber = BeardedMath.IsNumber(getter());

			if (!this.IsNumber && !this.IgnoreLerp)
				this.IgnoreLerp = true;

			PreviousValue = getter();
		}
BeardedMath