Created
January 9, 2020 14:50
-
-
Save GhostTW/bae9c6b000db9193dd8600e18083c26f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Main() | |
{ | |
PriceA.Dump("A"); | |
PriceB.Dump("B"); | |
PriceC.Dump("C"); | |
"---".Dump("GetPriceA()"); | |
ref decimal price = ref GetPriceA(); | |
PriceA.Dump("A"); | |
(++price).Dump("price++"); | |
PriceA.Dump("A"); | |
"---".Dump("GetPriceB()"); | |
price = GetPriceB(); | |
price.Dump("price"); | |
PriceA.Dump("A"); | |
PriceB.Dump("B"); | |
(++price).Dump("price++"); | |
PriceA.Dump("A"); | |
PriceB.Dump("B"); | |
"---".Dump("ref GetPriceC()"); | |
price = ref GetPriceC(); | |
price.Dump(); | |
PriceA.Dump("A"); | |
PriceB.Dump("B"); | |
PriceC.Dump("C"); | |
(++price).Dump("price++"); | |
PriceA.Dump("A"); | |
PriceB.Dump("B"); | |
PriceC.Dump("C"); | |
} | |
private decimal PriceA = 199; | |
private decimal PriceB = 99; | |
private decimal PriceC = 9; | |
public ref decimal GetPriceA() | |
{ | |
return ref this.PriceA; | |
} | |
public decimal GetPriceB() | |
{ | |
return this.PriceB; | |
} | |
public ref decimal GetPriceC() | |
{ | |
return ref this.PriceC; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment