P2PStateServer.ServiceMessage.GetKeyValue C# (CSharp) Метод

GetKeyValue() защищенный статический Метод

Parses a string for a Key and a Value
protected static GetKeyValue ( string Text, char Delimiter, string &Key, string &Value ) : void
Text string The text to parse
Delimiter char Delimiter seperating key and value
Key string Key
Value string Value
Результат void
        protected static void GetKeyValue(string Text, char Delimiter, out string Key, out string Value)
        {
            if (Text == null) throw new ArgumentNullException("Text");

            int index = Text.IndexOf(Delimiter);

            if (index < 1)
            {
                Key = Text;
                Value = string.Empty;
                return;
            }

            Key = Text.Substring(0, index);
            if (Key.Length == Text.Length)
            {
                Value = string.Empty;
            }
            else
            {
                Value = Text.Substring(index + 1);
            }
        }