I am new to C#, I wrote a code to prepare a *.xlsx file now I need to attach that file as an email attachment and send, but by doing that Thae mail body contains some junk data and also it is not giving any exceptions to catch.
i am working on Point of sale project. i am using devexpress for tile view in winform. how to create a dynamic Tile view and on click event i want to send category id and want to get the subcategory data. i tried alot but couldn't find any good solution.
i am creating pdf using iTextsharp dll , now i want some free/open source dll which will be a control to view the pdf in winform . I dont want any com component or webbrowser control to view . i need no dependencies too. I am finding it very challenging, can any help me with my RnD ?
Well, if you don't want any dependencies, you're going to have to rely on writing your own. There is a PDF specification but it's not a trivial thing to read, or implement. This article[^] shows you how many libraries you are going to have to replicate parts of.
Hi Pete ,
I have seen that article.
what are the other ways to view pdf document ?
PDFviewer or Adobe reader can be used from component but i dont want to use that.
Is there any other dll which will allow me to display pdf in winform ?
i am trying to understand async and await concept. so i am make sample program when i run this program take 8 seconds to execute if i execute without async and await it also take 8 second to execute. so what is wrong in this program.
How long would you expect it to complete in? You have 8 seconds worth of operation in there. I assume that you think that dowork will happen at the same time as DoAnotherWork. That's not the way that await operates. It's not, despite what you may think, something that pushes an operation off to another thread and continues processing in that thread - instead, it suspends the operation of the current method until the awaited operation completes. So, you end up with an 8 second delay.
I just have clarified it for you. The await keyword suspends the method until the task it's waiting on completes, then it moves onto the next operation in the chain. I'm not sure how else I can put this for you.
Using await doesn't mean your code acts asynchronously. It still behaves as if the code is running synchronously (which is why it takes 8 seconds) but the difference is that when using await the underlying framework means the thread is available to use for other tasks if needed. If you didn't use await and instead just waited for the task to finish then your code would act no differently, but the thread that is waiting for the result can't be used for something else if needed. If you remove the "await" from the dowork then the method will take 3 seconds as dowork will be started on its own task and that will execute asynchronously and then DoAnotherWork will be called which will block for 3s synchronously.
dowork(); // this will block execution for 5s as dowork is executed on the current thread
Task.Run(() => dowork()); // the dowork will happen on its own thread and that thread will run for 5 seconds// but the code in this block will continue to run so dowork is an asynchronous callawait Task.Run(() => dowork()); // a mix of both the above. The task will still run on its own thread for// 5 seconds, but execution will wait until that new thread has finished
Last Visit: 31-Dec-99 19:00 Last Update: 26-Feb-24 4:26