How would I go about returning the "var T" like the "var result" in the example below(code comments) in the new Thread that I created?
public QuoteResult GetQuote(QuoteData Data)
{
using (TruckDb db = new TruckDb())
{
const int stackSize = 8000000;
var T = new Thread(() => CalculateRates(db, Data), stackSize);
T.Priority = ThreadPriority.Highest;
T.Start();
T.Join();
//var result = CalculateRates(db, Data);
//return result; //Example of how I want it in the new thread created above
}
}
My CalculateRates method coding:
public QuoteResult CalculateRates(TruckDb db, QuoteData data)
{
var result = new QuoteResult
{
Successful = false,
Data = data
};
List<QuoteItemSectionGroup> quoteItems = new List<QuoteItemSectionGroup>();
var quoteItem = new QuoteItem
{
ChassisModel = db.ChassisModel.Find(data.ChassisId),
ChassisManufacturer = db.ChassisManufacturer.Find(data.ChassisManufacturerId),
BodyType = db.BodyTypes.Find(data.BodyTypeId),
//...10 lines more
};
//...unnecessary to see codes and calculations...
result.QuoteItem = quoteItem;
result.Successful = true;
return result;
}
I just need to run my CalculateRates method in a new thread to increase the stack size. If you need any more code or information, please don't hesitate to ask. Thank you!