public async Task <T> ReadMessageContents <T>(LDAPReader messageReader, int messageId) where T : LDAPResponse, new() { var op = new T() { MessageId = messageId }; await op.ReadContentsAsync(messageReader); return(op); }
/// <summary> /// Reads the individual PartialAttribute off the stream /// </summary> /// <param name="reader">The reader to read from</param> /// <returns>The LDAPAttribute value</returns> async Task <LDAPAttribute> ReadPartialAsync(LDAPReader reader) { var attr = new LDAPAttribute(); // Read the description attr.Description = await reader.ReadAsStringAsync(); attr.Values = new List <string>(); // Read the values await reader.GuardAsync((int)EncodingType.SET); var valReader = reader.CreateReader(); while (await valReader.ReadAsync()) { attr.Values.Add(await valReader.ReadAsStringAsync()); } return(attr); }