Showing the changes to Source/Libraries/GSF.Core/ArrayExtensions.cs (1 of 30 files). Show all
Unified · Split
| @@ -717,7 +717,7 @@ namespace GSF · 716 unmodified lines | ||
| 717 | 717 | /// <param name="bytes">Bytes containing structure.</param> |
| 718 | 718 | /// <returns>A structure from <paramref name="bytes"/>.</returns> |
| 719 | 719 | [MethodImpl(MethodImplOptions.AggressiveInlining)] |
| 720 | − public unsafe static T ReadStructure<T>(this byte[] bytes) | |
| 720 | + public unsafe static T ReadStructure<T>(this byte[] bytes) where T : struct | |
| 721 | 721 | { |
| 722 | 722 | T structure; |
| 723 | 723 | |
| @@ -736,7 +736,7 @@ namespace GSF · 12 unmodified lines | ||
| 736 | 736 | /// <param name="reader"><see cref="BinaryReader"/> positioned at desired structure.</param> |
| 737 | 737 | /// <returns>A structure read from <see cref="BinaryReader"/>.</returns> |
| 738 | 738 | [MethodImpl(MethodImplOptions.AggressiveInlining)] |
| 739 | − public static T ReadStructure<T>(this BinaryReader reader) | |
| 739 | + public static T ReadStructure<T>(this BinaryReader reader) where T : struct | |
| 740 | 740 | { |
| 741 | 741 | return reader.ReadBytes(Marshal.SizeOf(typeof(T))).ReadStructure<T>(); |
| 742 | 742 | } |