Lalit Rajput
Lalit Rajput

Reputation: 301

How to convert string to Cassandra.TimeUuid in c#

I am using Cassandra database in c#. I have a User table and it's have UserId column of TimeUuid type. Now the scenario is i have to pass UserId as string parameter in third party library's method. and in this method i have to convert this string to Cassandra.TimeUuid.

How can i convert this string to Cassandra.TimeUuid ?

Thanks

Upvotes: 1

Views: 1317

Answers (1)

jorgebg
jorgebg

Reputation: 6600

Currently the only way to create a TimeUuid instance from string is to do:

TimeUuid time = (TimeUuid) Guid.Parse(value);

Thanks to the implicit conversion operator defined in TimeUuid class.

It's not very intuitive so I've created a ticket to expose TimeUuid.Parse() method.

Upvotes: 1

Related Questions