Struct FieldValue
Holds a value of a Tiff tag.
Inherited Members
Namespace: BitMiracle.LibTiff.Classic
Assembly: BitMiracle.LibTiff.NET.dll
Syntax
public struct FieldValue
Remarks
Simply put, it is a wrapper around System.Object, that helps to deal with unboxing and conversion of types a bit easier.
Please take a look at: http://blogs.msdn.com/ericlippert/archive/2009/03/19/representation-and-identity.aspx
Properties
| Improve this Doc View SourceValue
Gets the value.
Declaration
public object Value { get; }
Property Value
| Type | Description |
|---|---|
| System.Object | The value. |
Methods
| Improve this Doc View SourceGetBytes()
Retrieves value converted to byte array.
Declaration
public byte[] GetBytes()
Returns
| Type | Description |
|---|---|
| System.Byte[] | Value converted to byte array. |
Remarks
If value is byte array then it retrieved unaltered.
If value is array of short, ushort, int, uint, float or double values then this array is converted to byte array
If value is a string then it gets converted to byte array using Latin1 encoding encoder.
If value is of any other type then null is returned.
ToByte()
Retrieves value converted to byte.
Declaration
public byte ToByte()
Returns
| Type | Description |
|---|---|
| System.Byte | The value converted to byte. |
ToByteArray()
Retrieves value converted to array of bytes.
Declaration
public byte[] ToByteArray()
Returns
| Type | Description |
|---|---|
| System.Byte[] | Value converted to array of bytes. |
Remarks
If value is array of bytes then it retrieved unaltered.
If value is array of short, ushort, int or uint values then each element of field value gets converted to byte and added to resulting array.
If value is string then it gets converted to byte[] using Latin1 encoding encoder.
If value is of any other type then null is returned.
ToDouble()
Retrieves value converted to double.
Declaration
public double ToDouble()
Returns
| Type | Description |
|---|---|
| System.Double | The value converted to double. |
ToDoubleArray()
Retrieves value converted to array of double values.
Declaration
public double[] ToDoubleArray()
Returns
| Type | Description |
|---|---|
| System.Double[] | Value converted to array of double values. |
Remarks
If value is array of double values then it retrieved unaltered.
If value is array of bytes then each 8 bytes are converted to double and added to resulting array. If value contains amount of bytes that can't be divided by 8 without remainder, then null is returned.
If value is array of float values then each element of field value gets converted to double and added to resulting array.
If value is of any other type then null is returned.
ToFloat()
Retrieves value converted to float.
Declaration
public float ToFloat()
Returns
| Type | Description |
|---|---|
| System.Single | The value converted to float. |
ToFloatArray()
Retrieves value converted to array of float values.
Declaration
public float[] ToFloatArray()
Returns
| Type | Description |
|---|---|
| System.Single[] | Value converted to array of float values. |
Remarks
If value is array of float values then it retrieved unaltered.
If value is array of bytes then each 4 bytes are converted to float and added to resulting array. If value contains amount of bytes that can't be divided by 4 without remainder, then null is returned.
If value is array of double values then each element of field value gets converted to float and added to resulting array.
If value is of any other type then null is returned.
ToInt()
Retrieves value converted to int.
Declaration
public int ToInt()
Returns
| Type | Description |
|---|---|
| System.Int32 | The value converted to int. |
ToIntArray()
Retrieves value converted to array of int values.
Declaration
public int[] ToIntArray()
Returns
| Type | Description |
|---|---|
| System.Int32[] | Value converted to array of int values. |
Remarks
If value is array of int values then it retrieved unaltered.
If value is array of bytes then each 4 bytes are converted to int and added to resulting array. If value contains amount of bytes that can't be divided by 4 without remainder, then null is returned.
If value is array of short, ushort or uint values then each element of field value gets converted to int and added to resulting array.
If value is of any other type then null is returned.
ToLong()
Retrieves value converted to long.
Declaration
public long ToLong()
Returns
| Type | Description |
|---|---|
| System.Int64 | The value converted to long. |
TolongArray()
Retrieves value converted to array of long values.
Declaration
public long[] TolongArray()
Returns
| Type | Description |
|---|---|
| System.Int64[] | Value converted to array of long values. |
Remarks
If value is array of long values then it retrieved unaltered.
If value is array of bytes then each 8 bytes are converted to uint and added to resulting array. If value contains amount of bytes that can't be divided by 8 without remainder, then null is returned.
If value is array of short, ushort or int values then each element of field value gets converted to long and added to resulting array.
If value is of any other type then null is returned.
ToShort()
Retrieves value converted to short.
Declaration
public short ToShort()
Returns
| Type | Description |
|---|---|
| System.Int16 | The value converted to short. |
ToShortArray()
Retrieves value converted to array of short values.
Declaration
public short[] ToShortArray()
Returns
| Type | Description |
|---|---|
| System.Int16[] | Value converted to array of short values. |
Remarks
If value is array of short values then it retrieved unaltered.
If value is array of bytes then each pair of bytes is converted to short and added to resulting array. If value contains odd amount of bytes, then null is returned.
If value is array of ushort, int or uint values then each element of field value gets converted to short and added to resulting array.
If value is of any other type then null is returned.
ToString()
Retrieves value converted to string.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| System.String | A System.String that represents this instance. |
Overrides
Remarks
If value is a byte array, then it gets converted to string using Latin1 encoding encoder.
ToUInt()
Retrieves value converted to uint.
Declaration
[CLSCompliant(false)]
public uint ToUInt()
Returns
| Type | Description |
|---|---|
| System.UInt32 | The value converted to uint. |
ToUIntArray()
Retrieves value converted to array of uint values.
Declaration
[CLSCompliant(false)]
public uint[] ToUIntArray()
Returns
| Type | Description |
|---|---|
| System.UInt32[] | Value converted to array of uint values. |
Remarks
If value is array of uint values then it retrieved unaltered.
If value is array of bytes then each 4 bytes are converted to uint and added to resulting array. If value contains amount of bytes that can't be divided by 4 without remainder, then null is returned.
If value is array of short, ushort or int values then each element of field value gets converted to uint and added to resulting array.
If value is of any other type then null is returned.
ToUShort()
Retrieves value converted to ushort.
Declaration
[CLSCompliant(false)]
public ushort ToUShort()
Returns
| Type | Description |
|---|---|
| System.UInt16 | The value converted to ushort. |
ToUShortArray()
Retrieves value converted to array of ushort values.
Declaration
[CLSCompliant(false)]
public ushort[] ToUShortArray()
Returns
| Type | Description |
|---|---|
| System.UInt16[] | Value converted to array of ushort values. |
Remarks
If value is array of ushort values then it retrieved unaltered.
If value is array of bytes then each pair of bytes is converted to ushort and added to resulting array. If value contains odd amount of bytes, then null is returned.
If value is array of short, int or uint values then each element of field value gets converted to ushort and added to resulting array.
If value is of any other type then null is returned.