SetString in C#

Hi,

I can’t convert this code to C#

using System;
using Rhino;

var doc = RhinoDoc.ActiveDoc;
var key = "test";
var value = "Hello Rhino!";
doc.Strings.SetString(key, value);

Console.WriteLine(doc.Strings.GetValue(key));
3 Likes

ok thanks @Mahdiyar works :+1:

I hope I don’t bother anyone if I don’t open a specific 3d for this addition:

Console.WriteLine(doc.Strings.GetValue(key));

Console.WriteLine(doc.Strings.Count);
Console.WriteLine(doc.Strings.GetEntryNames(key));
Console.WriteLine(doc.Strings.GetSectionNames());

out:

Hello Rhino!
1
System.String
System.String

after running the script, the key value, the total number of dictionaries present and two
types of string lists are printed. but in the last two cases shouldn’t it return the entire list?

Return list of all entry names for a given section of user data strings in the document.

Returns a list of all the section names for user data strings in the document. By default a section name is a key that is prefixed with a string separated by a backslash.

immagine