This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
fuss:libopenmetaverse [2015/01/05 23:46] – [Extract Full Avatar Name] office | fuss:libopenmetaverse [2022/04/19 08:28] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Extract Full Avatar Name ====== | ||
+ | libopenmetaverse uses different possible avatar name formats when passing avatar names. For example, an avatar name can be in one of the following formats: | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | |||
+ | |||
+ | The following brief LINQ query will help you resolve all these names to a list of two elements: | ||
+ | <code csharp> | ||
+ | string avatarName = " | ||
+ | // ... | ||
+ | List< | ||
+ | new List< | ||
+ | .Cast< | ||
+ | .ToDictionary(o => new[] | ||
+ | { | ||
+ | o.Groups[" | ||
+ | o.Groups[" | ||
+ | }).SelectMany(o => new[] {o.Key[0], !string.IsNullOrEmpty(o.Key[1]) ? o.Key[1] : " | ||
+ | Console.WriteLine(name.First()); | ||
+ | Console.WriteLine(name.Last()); | ||
+ | Console.ReadKey(); | ||
+ | </ | ||
+ | |||
+ | where the list '' |