public async Task WriteAsync(LDAPAttribute attr) { var attWriter = new LDAPWriter(); await attWriter.WriteAsync(attr.Description); var valuesWriter = new LDAPWriter(); foreach (var value in attr.Values) { await valuesWriter.WriteAsync(value); } await attWriter.WriteAsync(valuesWriter, (int)EncodingType.SET); await WriteAsync(attWriter); }
/// <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); }