Yawnder
Yawnder
CC#
Created by SWEETPONY on 3/19/2025 in #help
✅ How to make httpcontext threadsafe?
Any reason why you want to do that rather than using the HttpClientFactory?
6 replies
CC#
Created by steven preadly on 3/11/2025 in #help
method are not stored in object but can be called from object?
Unless you elaborate on what you actually want to know, or what that question evenly is, I'll just move on.
12 replies
CC#
Created by Fattouh on 3/11/2025 in #help
Basket feature in ASP.NET with EF Core & Web API
A session cookie imo. You don't want to put all that crap in your database, and you don't want to overload your servers either.
2 replies
CC#
Created by steven preadly on 3/11/2025 in #help
method are not stored in object but can be called from object?
How so?
12 replies
CC#
Created by steven preadly on 3/11/2025 in #help
method are not stored in object but can be called from object?
The memory where a class definition resides could change over the course of the execution of the program from what I understand.
12 replies
CC#
Created by steven preadly on 3/11/2025 in #help
method are not stored in object but can be called from object?
The memory isn't fixed at the startup of the program for example.
12 replies
CC#
Created by steven preadly on 3/11/2025 in #help
method are not stored in object but can be called from object?
Yes and no.
12 replies
CC#
Created by steven preadly on 3/11/2025 in #help
method are not stored in object but can be called from object?
So for example, if you have 1000 instances of a class that has 8 bytes of data, but a method that takes 500 bytes, it wouldn't take 1000 x 508 bytes.
12 replies
CC#
Created by steven preadly on 3/11/2025 in #help
method are not stored in object but can be called from object?
Sorry, I misclicked the reactions. The methods aren't stored in the object, they're stored in the class definition.
12 replies
CC#
Created by Tommy’sGun on 3/7/2025 in #help
✅ Does it take both types?
Also, $code
12 replies
CC#
Created by Tommy’sGun on 3/7/2025 in #help
✅ Does it take both types?
Which method? This is just free-form code.
12 replies
CC#
Created by Mango on 2/13/2025 in #help
Need an extension method to generate a random decimal within a range
Anyhow, gtg. You already have many ways to skin the cat.
70 replies
CC#
Created by Mango on 2/13/2025 in #help
Need an extension method to generate a random decimal within a range
You could be lazy then... rnd.Next(-30000M,30000M)/100M
70 replies
CC#
Created by Mango on 2/13/2025 in #help
Need an extension method to generate a random decimal within a range
No. There is nothing in the requirements that talks about rounding. If "good enough" is the requirement, good enough is good enough.
70 replies
CC#
Created by Mango on 2/13/2025 in #help
Need an extension method to generate a random decimal within a range
(ignore the scale difference in my sarcastic message)
70 replies
CC#
Created by Mango on 2/13/2025 in #help
Need an extension method to generate a random decimal within a range
And it might not be perfectly distributed. Like you might get more or less chances of getting a number between 0.947259863249856 and 0.947259863249857 and you would between 0.4397747587 and 0.4397747588
70 replies
CC#
Created by Mango on 2/13/2025 in #help
Need an extension method to generate a random decimal within a range
public static decimal MyThing(this Random rnd, decimal lowerBound, decimalUpperBound)
{
// Guard for lower < upper
return (upperBound-lowerBound)*(decimal)rnd.NextDouble()+lowerBound;
}
public static decimal MyThing(this Random rnd, decimal lowerBound, decimalUpperBound)
{
// Guard for lower < upper
return (upperBound-lowerBound)*(decimal)rnd.NextDouble()+lowerBound;
}
70 replies
CC#
Created by Mango on 2/13/2025 in #help
Need an extension method to generate a random decimal within a range
Ok, so you want to use the same seed? Alright. Do you have a requirement that the random has to be "perfect", or just "quite good enough"?
70 replies
CC#
Created by Mango on 2/13/2025 in #help
Need an extension method to generate a random decimal within a range
Ok. You want to extend what?
70 replies