C# 7 provides a very powerful feature from the performance standpoint. This feature is returning by ref. Essentially this allows for value types to be returned without having to copy them.
The guidelines are normally that you shouldn’t use a struct with too many fields. Various sources quote various size guidelines. Whenever the struct was over the prescribed size it was recommended that you pass it by reference.
With the new syntax for returning types by reference, it’s now more convenient (no more methods returning via out parameter) to use structs.
In performance critical scenarios where you need to avoid polluting managed heap with too many Gen #0 objects using structs has now become more natural. In the past dealing with structs was somewhat cumbersome if you dealt with a large number of fields and needed to avoid copying of values.
I have worked on a large application at McLaren – Telemetry Acquisition System that is supplied to all teams. The performance of the application is very critical as it has to process gigabytes of telemetry data. We have used structs extensively to squeeze out every bit of performance from .NET runtime.
I think it’s my second favourite feature after value tuples.
I think it says a lot about the developer what sort of PC he/she has. Back when I was in my early 20 I had several:
So despite me getting older I am still a geek
The Task Parallel Library (TPL) was introduced in the .NET Framework 4, providing core building blocks and algorithms for parallel computation and asynchrony. This work was centered around the System.Threading.Tasks.Task type, as well as on a few higher-level constructs. These higher-level constructs address a specific subset of common parallel patterns, e.g. Parallel.For/ForEach for delightfully parallel problems expressible as parallelized loops.
While a significant step forward in enabling developers to parallelize their applications, this work did not provide higher-level constructs necessary to tackle all parallel problems or to easily implement all parallel patterns. In particular, it did not focus on problems best expressed with agent-based models or those based on message-passing paradigms. These kinds of problems are quite prevalent in technical computing domains such as finance, biological sciences, oil & gas, and manufacturing.
For TPL Dataflow (TDF), we build upon the foundational layer provided in TPL in .NET 4. TDF is a complementary set of primitives to those primitives delivered in TPL in .NET 4, addressing additional scenarios beyond those directly and easily supported with the original APIs. TPL Dataflow utilizes tasks, concurrent collections, tuples, and other features introduced in .NET 4 to bring support for parallel dataflow-based programming into the .NET Framework. It also directly integrates with new language support for tasks and asynchrony provided by both C# and Visual Basic, and with existing language support in .NET 4 for tasks provided by F#.
The idea is very simple, you cherry-pick the applications, click on get installer and you get the installer with all the latest applications you selected as one file.
Next time you reinstalling Windows go to https://ninite.com/ and create yourself and installation package
In all previous versions of C# (with the exception of C# 6.0 maybe) new features have revolved around a specific theme:
C# 7.0 is no exception to this rule. The language designers were focusing on three main themes:
View original post 1,825 more words
I’m not the only one who got burnt by ThreadStatic
To measure the efficiency of our analyzer, and also to promote the methodology of static analysis, we regularly analyze open source projects for bugs and write articles about the results. 2016 was no exception. This year is especially important as it is the year of the “growth” of the C# analyzer. PVS-Studio has obtained a large number of new C# diagnostics, an improved virtual values mechanism (symbolic execution) and much more. Based on the results of our teamwork, I compiled a kind of chart of the most interesting bugs, found in various C# projects in 2016.
View original post 1,367 more words
I’ve said it before. In my opinion, WPF is the single contemporary programming technology (disclaimer: among those that I’ve considered myself) that really requires a book to learn it. Otherwise, trying to dig using just hands on testing – as it’s indeed possible in many other cases – you might think you know enough before you do and you’ll get frustrated every day later because things won’t work the way you’d think they should. This StackOverflow question – that triggered this post – is only an example. I personally have been there too (and after the WPF experience, now I decided that I’ll always learn complex new technologies using books, although it may be unnecessary in some cases, as I’ve seen before WPF.)
But don’t get scared. Mastering WPF by starting learning it from the core instead of from the surface will provide many, many benefits that will overcome any…
View original post 146 more words
Definitely something to play with when my brain has more oxygen (suffering from anaemia right now)
AForge.NET is a C# framework designed for developers and researchers in the fields of Computer Vision and Artificial Intelligence – image processing, neural networks, genetic algorithms, machine learning, robotics, etc.
are mainly topic in this framework. İf you want more information and help visit: https://code.google.com/p/aforge/
The week before last, on Thursday I suddenly felt something in the stomach, it wasn’t painful, felt more like a cramp. That happened around 14:30 then around 17:40 I decided to go home, stood up and could feel that my heart was racing. I initially thought nothing of it and decided to go home. However as soon as I tried to cross the road I felt that something was seriously wrong with me and I had to sit down. I then slowly proceeded to the closest tube station but even that proved extremely difficult.
I finally gave in and got a cab that took me to the train station. Thinking about the stomach cramp I had earlier I thought I had a bad sandwich and one day off sick should do it.
Meanwhile I could barely walk and after getting to the second floor of my house my blood pressure would skyrocket to 160/110 and my pulse would be around 130bpm. Everyone around me was commenting on how pale I looked, suggesting I go to the A&E. Initially I refused, but later I realised that I’m not getting any better and the A&E wouldn’t be such a bad idea.
So my dad drove me to the local hospital (my mum works there as well) and we went to the A&E. Expecting to wait for ages I was actually admitted relatively quickly, by then I really looked very sick. A nurse took few vials of my blood and sent me back to the waiting room.
Half an hour later they asked for me again but this time I was greated by a guy with the wheel chair! This is where I got really really scared. Then the nurse told me that the lab called them to tell that my haemoglobin level was 49 g/L (this is dangerously low, versus normal 160 g/L) and I require an emergency blood transfusions and would remain in the hospital. I was beyond scared by this point.
They said that normally people collapse when their haemoglobin levels are that low and the fact that I was relatively “alive” meant that my body got used to it. After even the first unit of blood (308ml) I felt almost high and full of energy. The consultant said that I require at least 4 units to get my levels above critical (1.2 litres in total). Each bag takes about 2-3 hours and my transfusions lasted well into the night. By then I was moved to the observation ward.
Next morning I was taken for the ultra-sound, and then for upper endoscopy (which was “fun” as I didn’t feel any sedation) , as they were thinking that I must have a bleed somewhere resulting in slow blood loss. Nothing was found.
Next day at the hospital they took about 20 vials of my blood for various tests. The consultant haematologist couldn’t find anything either apart from my still very low haemoglobin (81 g/L after all transfusions).
In the end I was discharged with a diagnosis of “iron deficiency anaemias”. Which means that I either don’t absorb enough iron (celiac disease would do that for example) or have a bleeding somewhere in my lower GI. I was given a bunch of ferrous sulphate pills to help maintain my iron levels.
Upon discharge from the hospital I was still a bit high from the blood transfusions, but that quickly subsided. Then all the “pleasant” symptoms from anaemia appeared – extreme chills (I would wear my hoodie even if it was +24 in a room), shortness of breath, headache, low grade fever, anxiety, inability and unwillingness to do anything, insomnia, night sweats, inability to regulate body temperature. Every day I would measure my blood pressure to gauge how hard my heart was working. If I had been sitting for 2 minutes or more my blood pressure was perfect 117/77, however if I did something slightly physically demanding it would again skyrocket to about 140/100. After 5 days of taking the medication I wasn’t feeling any better. Every day would be like a Groundhog day to me – I would wake up at 6 after only sleeping 4-5 hours and having nightmares. I would then sit quietly on the sofa wearing everything to get worm, even though the room temperature was never below 23C. I would then spend the whole day watching telly and sleeping which in turn would make my insomnia even worse.
However today is day #10 and it’s the second consecutive day that I suddenly started to feel better – temperature is down, I can walk without stopping, my headaches are gone and so are the chills.
I still have several outpatient procedures to go to establish the exact cause of such acute onset of anaemia.
All in all anaemia sucks big time, because of lack of oxygen in your blood it hurts to think, I couldn’t sit in front of my PC at all, you hate yourself for not being able to do anything, one of the most unbearable symptoms is the constant feeling of cold. It basically sucks all the will to live out of you!
In the hindsight, my symptoms began long before August this year, now I think that I might have had some anaemia for at least 6-7 years. I’m now looking forward to recovery, and if I had it for a while I wonder how I would feel with the normal haemoglobin levels!
Day #11 and I certainly don’t feel any worse. About to drive to the clinic all by myself!