예제 #1
0
        /// <summary>
        /// Convert from <see cref="System.Protobuf.DictionaryValue"/> to <see cref="Events.Relativity.Protobuf.PropertyBag"/>
        /// </summary>
        /// <param name="dictionaryValue"></param>
        /// <returns></returns>
        public static Events.Relativity.Protobuf.PropertyBag AsPropertyBag(this System.Protobuf.DictionaryValue dictionaryValue)
        {
            var propertyBag = new Events.Relativity.Protobuf.PropertyBag();

            dictionaryValue.Object.ForEach(kvp => propertyBag.Values.Add(kvp.Key, kvp.Value));
            return(propertyBag);
        }
예제 #2
0
        /// <summary>
        /// Convert from <see cref="Events.Relativity.Protobuf.PropertyBag"/> to <see cref="System.Protobuf.DictionaryValue"/>
        /// </summary>
        /// <param name="propertyBag"></param>
        /// <returns></returns>
        public static System.Protobuf.DictionaryValue AsDictionaryValue(this Events.Relativity.Protobuf.PropertyBag propertyBag)
        {
            var dictionaryValue = new System.Protobuf.DictionaryValue();

            propertyBag.Values.ForEach(kvp => dictionaryValue.Object.Add(kvp.Key, kvp.Value));
            return(dictionaryValue);
        }
예제 #3
0
 /// <summary>
 /// Read value from <see cref="System.Protobuf.DictionaryValue"/>
 /// </summary>
 /// <param name="dictionary"><see cref="System.Protobuf.DictionaryValue"/> to read from</param>
 /// <returns>The <see cref="Dolittle.PropertyBags.PropertyBag"/></returns>
 public static Dolittle.PropertyBags.PropertyBag ToCLR(this System.Protobuf.DictionaryValue dictionary) => dictionary.Object.ToCLR();