You only need the async modifier if you've got an await in the method. All this method needs to do is return a Task or some kind, which your method isn't doing. A dirty conversion of your code to returning a Task would be:
public Task<CompanyEntity> GetCompany(int id)
return Task.Factory.StartNew<CompanyEntity>(() =>
using (var db = new JayhawkDB())
CompanyEntity results = null;
var query = from x in db.Companies
where x.Id == id
var record = query.FirstOrDefault<Company>();
results = new CompanyEntity
Id = record.Id,
CreatedById = record.CreatedById,
CreatedDT = record.CreatedDt,
DeletedById = record.DeletedById.GetValueOrDefault(),
DeletedDT = record.DeletedDt.GetValueOrDefault(),
CompanyName = record.CompanyName,
Abbreviation = record.Abbreviation,
Notes = record.Notes
The caller awaits this code, not the other way around.
Oh, and that try/catch block is pretty much useless if all you're going to do is catch all Exceptions and just re-throw them.
System.ItDidntWorkException: Something didn't work as expected.
This works, sort of. However, it does not give me the raw input from the keyboard so when AltGr is pressed it canges from Key.RightAlt => Key.LeftCtrl + Key.RightAlt whitch is Windows interpretation according to this: AltGr key - Wikipedia[^]. I dont want this, as I want the user to be able to "bind" any key to a spesific action.
That could work, but I also want it to react to a sequence of inputs like Visual Studio does. For instance, if you have selected parts of the code you can hold LeftCtrl + K, release the keys and press LeftCtrl + F, VS will format the code for you. Then KeyBoard.IsDown is not really usable.
The problem is that I need to know what happened on your keyboard before windows do changes to it.
I'd have to say this smells badly of spam - it's a limited trial of a paid-for app, and you've been here long enough to know that is the kind of thing that attracts "spam" and "spammer" votes and gets your account closed. Particularly when it's a "special promo" for CodeProject as the link implies.
I don't think spam was your intention, but I'd strongly suggest that you remove the link before it gets reported in S&A and you get kicked out.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
In Visual C#, I made a user control, which contains several separate "individual" properties. But I would like to make it into one. In which there is a plus sign in font of my property where users could click on it and expand it and access its members. Just like the property Location, Size, or Font.
I tried packaging all those properties into one class and use the class as the property type, but then I have no idea how to get or set the values! And the property just return the whole class as the value! There is NO plus sign for anybody to click!
PLEASE help me out! Thank you very VERY much! God bless you!!!
To create a Property like this you must create a Class-Object which holds the necessary Sub-Properties.
This Object should also use as TypeConverter the ExpandableObjectConverter.
Now you can use this Class-Object as Type for your Property.
Hi I need to refactor this code..thanks in advance for any help!!
public MyListViewModel GetData(List<UpdatingViewModel> updatingList, MyListViewModel myList)
foreach(UpdatingViewModel x in updatingList)
x.Gain = myList.UpdatingView.Gain;
x.Amount = myList.UpdatingView.Amount;
x.Minimum = myList.UpdatingView.Minimum;
x.Charge = myList.UpdatingView.Charge;
x.abc = myList.UpdatingView.abc;
Last Visit: 31-Dec-99 19:00 Last Update: 31-Jan-23 1:27