Ejemplo n.º 1
0
 private SdpDataElement(SdpDataElementType type, object value)
 {
     this._type  = type;
     this._value = value;
 }
Ejemplo n.º 2
0
 private SdpDataElement()
 {
     _type = SdpDataElementType.Nil;
 }
Ejemplo n.º 3
0
        public SdpDataElement(object value)
        {
            if (value == null)
            {
                _type = SdpDataElementType.Nil;
            }
            else
            {
                _value = value;

                if (value is bool)
                {
                    _type = SdpDataElementType.Boolean;
                }
                else if (value is byte)
                {
                    _type = SdpDataElementType.Byte;
                }
                else if (value is ushort)
                {
                    _type = SdpDataElementType.UInt16;
                }
                else if (value is uint)
                {
                    _type = SdpDataElementType.UInt32;
                }
                else if (value is ulong)
                {
                    _type = SdpDataElementType.UInt64;
                }
                else if (value is sbyte)
                {
                    _type = SdpDataElementType.SByte;
                }
                else if (value is short)
                {
                    _type = SdpDataElementType.Int16;
                }
                else if (value is int)
                {
                    _type = SdpDataElementType.Int32;
                }
                else if (value is long)
                {
                    _type = SdpDataElementType.Int64;
                }
                else if (value is Guid)
                {
                    _type = SdpDataElementType.Uuid128;
                }
                else if (value is string)
                {
                    _type = SdpDataElementType.String;
                }
                else if (value is IEnumerable <SdpDataElement> )
                {
                    _type = SdpDataElementType.Sequence;
                }
                else if (value is Uri)
                {
                    _type = SdpDataElementType.Uri;
                }
                else
                {
                    throw new ArgumentException("value is not an expected type");
                }
            }
        }