You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// Parses a file at the specified filepath into an array of objects of type T.
51
51
/// </summary>
52
52
/// <typeparam name="T"></typeparam>
@@ -63,20 +63,20 @@ Please see below.
63
63
T[] Parse<T>(string[] lines) where T : IFileLine, new();
64
64
65
65
/// <summary>
66
-
/// Parses a stream of delimiter separated records into an array of objects of type T.
66
+
/// Parses an array of bytes of delimiter separated records into an array of objects of type T.
67
67
/// </summary>
68
68
/// <typeparam name="T"></typeparam>
69
-
/// <param name="stream"></param>
69
+
/// <param name="bytes"></param>
70
70
/// <returns></returns>
71
-
T[] Parse<T>(Stream stream) where T : IFileLine, new();
71
+
T[] Parse<T>(byte[] bytes, Encoding encoding = null) where T : IFileLine, new();
72
72
73
73
/// <summary>
74
-
/// Parses an array of bytes of delimiter separated records into an array of objects of type T.
74
+
/// Parses a stream of delimiter separated records into an array of objects of type T.
75
75
/// </summary>
76
76
/// <typeparam name="T"></typeparam>
77
-
/// <param name="bytes"></param>
77
+
/// <param name="stream"></param>
78
78
/// <returns></returns>
79
-
T[] Parse<T>(byte[] bytes) where T : IFileLine, new();
79
+
T[] Parse<T>(Stream stream, Encoding encoding = null) where T : IFileLine, new();
80
80
81
81
/// <summary>
82
82
/// Asynchronously parses a file at the specified filepath into an array of objects of type T.
@@ -95,20 +95,21 @@ Please see below.
95
95
Task<T[]> ParseAsync<T>(string[] lines) where T : IFileLine, new();
96
96
97
97
/// <summary>
98
-
/// Asynchronously parses a stream of delimiter separated strings into an array of objects of type T.
98
+
/// Asynchronously parses an array of bytes of delimiter separated records into an array of objects of type T.
99
99
/// </summary>
100
100
/// <typeparam name="T"></typeparam>
101
-
/// <param name="stream"></param>
101
+
/// <param name="bytes"></param>
102
102
/// <returns></returns>
103
-
Task<T[]> ParseAsync<T>(Stream stream) where T : IFileLine, new();
103
+
Task<T[]> ParseAsync<T>(byte[] bytes, Encoding encoding = null) where T : IFileLine, new();
104
+
104
105
/// <summary>
105
-
/// Asynchronously parses an array of bytes of delimiter separated records into an array of objects of type T.
106
+
/// Asynchronously parses a stream of delimiter separated strings into an array of objects of type T.
106
107
/// </summary>
107
108
/// <typeparam name="T"></typeparam>
108
-
/// <param name="bytes"></param>
109
+
/// <param name="stream"></param>
109
110
/// <returns></returns>
110
-
Task<T[]> ParseAsync<T>(byte[] bytes) where T : IFileLine, new();
111
-
}
111
+
Task<T[]> ParseAsync<T>(Stream stream, Encoding encoding = null) where T : IFileLine, new();
112
+
}
112
113
```
113
114
To initialise `Parser` class you could do it manually or use dependency injection as shown below. The parser class has parameterised constructor that takes the delimiter character to initialise the instance. Default character is ',' (comma) to initialise the parser for a CSV file parsing.
114
115
@@ -338,6 +339,7 @@ The main branch is now on .NET 9.0.
0 commit comments