public static Scalar ScalarOf(String str) { Scalar.Types.String strValue = new Scalar.Types.String() { Value = ByteString.CopyFromUtf8(str) }; return(new Scalar() { Type = Scalar.Types.Type.VString, VString = strValue }); }
/** * Build an Any with a string value. */ public static Any BuildAny(String str) { // same as Expr Scalar.Types.String sstr = new Scalar.Types.String(); sstr.Value = ByteString.CopyFromUtf8(str); Scalar s = new Scalar(); s.Type = Scalar.Types.Type.VString; s.VString = sstr; Any a = new Any(); a.Type = Any.Types.Type.Scalar; a.Scalar = s; return(a); }