.NET 7 Preview 7 released: The next version enters the RC stage
- An American company made 0.7nm chips: EUV lithography machines can’t do it
- CVE-2007-4559 Python vulnerability ignored for 15 years puts 350,000 projects at risk of code execution
- RISC-V only takes 12 years to achieve the milestone of 10 billion cores
- 14000 cores + 450W: RTX 4080 graphics card perfectly replaces the RTX 3080
- Big upgrade: The difference between Bluetooth 5.0 and 5.2
- Geeks Disappointed that RTX 4080/4090 doesn’t come with PCIe 5.0
- What are advantages and disadvantages of different load balancing?
.NET 7 Preview 7 released, the next version enters the RC stage.
.NET 7 released the last preview version Preview 7 , after which it will enter the RC stage.
Major changes in this release include improvements to System.LINQ, Unix file permissions, underlying structures, p/Invoke source code generation, code generation, and websockets.
optimizationSystem.LINQ
System.Linq
Now contains Order
and OrderDescending
methods, which T
can IEnumerable
be sorted according to . IQueryable
Support for this is now also available.
usage
Previously needed to call / by referencing its own valueOrderBy
OrderByDescending
var data = new[] { 2, 1, 3 };
var sorted = data.OrderBy(static e => e);
var sortedDesc = data.OrderByDescending(static e => e);
It is now supported to write directly as:
var data = new[] { 2, 1, 3 };
var sorted = data.Order();
var sortedDesc = data.OrderByDescending();
Support for Unix file modes
Previously .NET had no built-in support for getting and setting Unix file permissions, which were used to control which users could read, write, and execute files and directories.
Also P/Invoking manually invoking syscalls is not easy because some syscalls are exposed differently on different distributions.
For example, on Ubuntu, you might want to Pinvoke__xstat
, on Red Hat , and so on. stat
For this purpose, Preview 7 introduces a new enumeration:
public enum UnixFileMode
{
None,
OtherExecute, OtherWrite, OtherRead,
GroupExecute, GroupWrite, GroupRead,
UserExecute, UserWrite, UserRead,
...
}
usage
// Create a new directory with specific permissions
Directory.CreateDirectory("myDirectory", UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute);
// Create a new file with specific permissions
FileStreamOptions options = new()
{
Access = FileAccess.Write,
Mode = FileMode.Create,
UnixCreateMode = UnixFileMode.UserRead | UnixFileMode.UserWrite,
};
using FileStream myFile = new FileStream("myFile", options);
// Get the mode of an existing file
UnixFileMode mode = File.GetUnixFileMode("myFile");
// Set the mode of an existing file
File.SetUnixFileMode("myFile", UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute);
Optimize the bottom layer struct
: supportref
fields
The .NET 7 runtime environment now fully supports fields (ie ) in the ByRefLikeref
type . ref struct
There is a lot of language design behind this feature, such as improving the underlying structure .
With this feature, types that previously required specialized handling in the runtime environment, such as Span<T>
and ReadOnlySpan<T>
, can now be fully implemented in C#.
- DIY a PBX (Phone System) on Raspberry Pi
- How to host multiple websites on Raspberry Pi 3/4?
- A Free Intercom/Paging system with Raspberry pi and old Android phones
- DIY project: How to use Raspberry Pi to build DNS server?
- Raspberry Pi project : How to use Raspberry Pi to build git server?