Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added some additional conversions to InetAddressType

  • Loading branch information...
commit 343c424b9dbf25b4b2cb9fdeed0192a7a69b4e7f 1 parent 46d43c9
@nberardi nberardi authored
Showing with 8 additions and 12 deletions.
  1. +3 −0  src/Types/CassandraObject.cs
  2. +5 −12 src/Types/InetAddressType.cs
View
3  src/Types/CassandraObject.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Net;
using System.Numerics;
namespace FluentCassandra.Types
@@ -126,6 +127,7 @@ private static CassandraObject ConvertFrom(object o)
public static implicit operator CassandraObject(DateTimeOffset o) { return ConvertFrom(o); }
public static implicit operator CassandraObject(BigInteger o) { return ConvertFrom(o); }
public static implicit operator CassandraObject(BigDecimal o) { return ConvertFrom(o); }
+ public static implicit operator CassandraObject(IPAddress o) { return ConvertFrom(o); }
public static implicit operator byte[](CassandraObject o) { return ConvertTo<byte[]>(o); }
public static implicit operator char[](CassandraObject o) { return ConvertTo<char[]>(o); }
@@ -149,6 +151,7 @@ private static CassandraObject ConvertFrom(object o)
public static implicit operator DateTimeOffset(CassandraObject o) { return ConvertTo<DateTimeOffset>(o); }
public static implicit operator BigInteger(CassandraObject o) { return ConvertTo<BigInteger>(o); }
public static implicit operator BigDecimal(CassandraObject o) { return ConvertTo<BigDecimal>(o); }
+ public static implicit operator IPAddress(CassandraObject o) { return ConvertTo<IPAddress>(o); }
public static implicit operator byte?(CassandraObject o) { return ConvertTo<byte?>(o); }
public static implicit operator sbyte?(CassandraObject o) { return ConvertTo<sbyte?>(o); }
View
17 src/Types/InetAddressType.cs
@@ -60,20 +60,13 @@ public override int GetHashCode()
#region Conversion
- public static implicit operator IPAddress(InetAddressType type)
- {
- return type._value;
- }
-
- public static implicit operator InetAddressType(IPAddress o)
- {
- return new InetAddressType {
- _value = o
- };
- }
-
+ public static implicit operator InetAddressType(IPAddress o) { return ConvertFrom(o); }
public static implicit operator InetAddressType(byte[] o) { return ConvertFrom(o); }
+ public static implicit operator InetAddressType(string o) { return ConvertFrom(o); }
+
+ public static implicit operator IPAddress(InetAddressType o) { return ConvertTo<IPAddress>(o); }
public static implicit operator byte[](InetAddressType o) { return ConvertTo<byte[]>(o); }
+ public static implicit operator string(InetAddressType o) { return ConvertTo<string>(o); }
private static T ConvertTo<T>(InetAddressType type)
{
Please sign in to comment.
Something went wrong with that request. Please try again.