Partager via


Short Class

Definition

The Short class wraps a value of primitive type short in an object.

[Android.Runtime.Register("java/lang/Short", DoNotGenerateAcw=true)]
public sealed class Short : Java.Lang.Number, IDisposable, Java.Interop.IJavaPeerable, Java.Lang.IComparable
[<Android.Runtime.Register("java/lang/Short", DoNotGenerateAcw=true)>]
type Short = class
    inherit Number
    interface IComparable
    interface IJavaObject
    interface IDisposable
    interface IJavaPeerable
Inheritance
Attributes
Implements

Remarks

The Short class wraps a value of primitive type short in an object. An object of type Short contains a single field whose type is short.

In addition, this class provides several methods for converting a short to a String and a String to a short, as well as other constants and methods useful when dealing with a short.

<!-- Android-removed: paragraph on ValueBased

This is a value-based class; programmers should treat instances that are #equals(Object) equal as interchangeable and should not use instances for synchronization, or unpredictable behavior may occur. For example, in a future release, synchronization may fail. -->

Added in 1.1.

Java documentation for java.lang.Short.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Constructors

Short(Int16)

Constructs a newly allocated Short object that represents the specified short value.

Short(String)

Constructs a newly allocated Short object that represents the short value indicated by the String parameter.

Fields

Bytes

The number of bytes used to represent a short value in two's complement binary form.

MaxValue

A constant holding the maximum value a short can have, 2<sup>15</sup>-1.

MinValue

A constant holding the minimum value a short can have, -2<sup>15</sup>.

Size

The number of bits used to represent a short value in two's complement binary form.

Properties

Class

Returns the runtime class of this Object.

(Inherited from Object)
Handle

The handle to the underlying Android instance.

(Inherited from Object)
JniIdentityHashCode (Inherited from Object)
JniPeerMembers
PeerReference (Inherited from Object)
ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from Number)
ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from Number)
Type

The Class instance representing the primitive type short.

Methods

ByteValue()

Returns the value of the specified number as a byte.

(Inherited from Number)
Clone()

Creates and returns a copy of this object.

(Inherited from Object)
Compare(Int16, Int16)

Compares two short values numerically.

CompareTo(Short)

Compares two Short objects numerically.

CompareUnsigned(Int16, Int16)

Compares two short values numerically treating the values as unsigned.

Decode(String)

Decodes a String into a Short.

Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
DoubleValue()

Returns the value of this Short as a double after a widening primitive conversion.

Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
FloatValue()

Returns the value of this Short as a float after a widening primitive conversion.

GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
HashCode(Int16)

Returns a hash code for a short value; compatible with Short.hashCode().

IntValue()

Returns the value of this Short as an int after a widening primitive conversion.

JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
LongValue()

Returns the value of this Short as a long after a widening primitive conversion.

Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
ParseShort(String, Int32)

Parses the string argument as a signed short in the radix specified by the second argument.

ParseShort(String)

Parses the string argument as a signed decimal short.

ReverseBytes(Int16)

Returns the value obtained by reversing the order of the bytes in the two's complement representation of the specified short value.

SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
ShortValue()

Returns the value of the specified number as a short.

(Inherited from Number)
ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
ToString(Int16)

Returns a new String object representing the specified short.

ToUnsignedInt(Int16)

Converts the argument to an int by an unsigned conversion.

ToUnsignedLong(Int16)

Converts the argument to a long by an unsigned conversion.

UnregisterFromRuntime() (Inherited from Object)
ValueOf(Int16)

Returns a Short instance representing the specified short value.

ValueOf(String, Int32)

Returns a Short object holding the value extracted from the specified String when parsed with the radix given by the second argument.

ValueOf(String)

Returns a Short object holding the value given by the specified String.

Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)

Operators

Explicit(Short to Int16)

Explicit Interface Implementations

IComparable.CompareTo(Object)
IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to