Top "Unsafe" questions

In C# or Rust, the unsafe keyword marks code able to work directly with memory pointers, bypassing some of the language's safety checks.

Fast array copy in C#

I have a C# class that contains an int[] array (and a couple of other fields, but the array is …

c# arrays performance unsafe
What is the fastest way to convert a float[] to a byte[]?

I would like to get a byte[] from a float[] as quickly as possible, without looping through the whole array (…

c# unsafe
Deleting C# Unsafe Pointers

I know using the /unsafe flag in C#, you can use pointers. In C/C++ to delete a pointer you …

c# .net pointers memory-management unsafe
Faster (unsafe) BinaryReader in .NET

I came across a situation where I have a pretty big file that I need to read binary data from. …

c# performance pointers unsafe binaryreader
Why are Python multiprocessing Pipe unsafe?

I don't understand why Pipes are said unsafe when there are multiple senders and receivers. How the following code can …

python multiprocessing pipe unsafe
How can I display a pointer address in C#?

I've not done any pointers since I've been programming in C# - and my C++ days were long ago. I …

c# pointers unsafe
Fixed Size Array of Structure type

how do I declare fixed-size array of a structure type in C# : [StructLayout(LayoutKind.Sequential,Pack=1), Serializable] public unsafe struct …

c# arrays struct marshalling unsafe
Arithmetic operation resulted in an overflow in unsafe C#

Background We've been using some code copied verbatim from Joe Duffy's "Concurrent Programming on Windows" (page 149) in production for over …

c# overflow stack-overflow unsafe uint
Unsafe code compilation error in .NET Core even after setting allowunsafe flag to true in project.json

I am using some unsafe code in my .NET Core app. For that, I had made this change in the …

.net .net-core unsafe coreclr
How can I use unsafe code in VB.Net?

I would like to know the VB.NET equivalent of the following C# code: unsafe { byte* pStart = (byte*)(void*)writeableBitmap.…

c# vb.net unsafe