I am trying to learn C# and I am familiar with the C++ struct pointing notation ->
. I was curious if that crossed over into C#.
Example:
someStruct->someAttribute += 1;
Hepatitis C is a liver infection caused by the hepatitis C virus (HCV). Hepatitis C is spread through contact with blood from an infected person. Today, most people become infected with the hepatitis C virus by sharing needles or other equipment used to prepare and inject drugs.
Hepatitis C virus (HCV) causes both acute and chronic infection. Acute HCV infections are usually asymptomatic and most do not lead to a life-threatening disease. Around 30% (15–45%) of infected persons spontaneously clear the virus within 6 months of infection without any treatment.
Hepatitis C is spread only through exposure to an infected person's blood. High-risk activities include: Sharing drug use equipment. Anything involved with injecting street drugs, from syringes, to needles, to tourniquets, can have small amounts of blood on it that can transmit hepatitis C.
Like the other antivirals, the side effects are mild. You might have a slight headache or bellyache, or you might feel tired. Glecaprevir and pibrentasvir (Mavyret): Three pills daily can treat all types of hep C. Side effects are mild and can include headache, fatigue, diarrhea, and nausea.
There is pointer notation in C#, but only in special cases, using the unsafe
keyword.
Regular objects are dereferenced using .
, but if you want to write fast code, you can pin data (to avoid the garbage collector moving stuff around) and thus "safely" use pointer arithmetic, and then you might need ->
.
See Pointer types (C# Programming Guide) and a bit down in this example on the use of ->
in C#.
It looks something like this (from the last link):
struct MyStruct
{
public long X;
public double D;
}
unsafe static void foo()
{
var myStruct = new MyStruct();
var pMyStruct = & myStruct;
// access:
(*pMyStruct).X = 18;
(*pMyStruct).D = 163.26;
// or
pMyStruct->X = 18;
pMyStruct->D = 163.26;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With