public static byte[] GetBytes(List <FileNotifyInformation> notifyInformationList) { int listLength = GetListLength(notifyInformationList); byte[] buffer = new byte[listLength]; int offset = 0; for (int index = 0; index < notifyInformationList.Count; index++) { FileNotifyInformation entry = notifyInformationList[index]; int length = entry.Length; int paddedLength = (int)Math.Ceiling((double)length / 4) * 4; if (index < notifyInformationList.Count - 1) { entry.NextEntryOffset = (uint)paddedLength; } else { entry.NextEntryOffset = 0; } entry.WriteBytes(buffer, offset); offset += paddedLength; } return(buffer); }