{%Pragmatic Coding%} Tips and tricks for software developers.


Cloning objects in C#

Few days ago I needed to clone object and than modify some data in it.

For example, get object from db and make clone this object with same data to be able to modify some specific properties. Something like

So, I decided to review abilities of cloning objects. Read the full article...

Tagged as: .NET, C# Continue reading

How To: Format Decimal.ToString() in C#

Today I have spent some time to find out how correctly convert and format decimal number to string representation with 2 decimal digits. And here is what I found and learned I want to share it with you my friend.
I'll give you several C# examples that shows how to format float numbers to string in C#. You can use static method String.Format or instance methods double.ToString and float.ToString.

Digits after decimal point

This example formats double to string with fixed number of decimal places. For two decimal places use pattern „0.00“. If a float number has less decimal places, the rest digits on the right will be zeroes. If it has more decimal places, the number will be rounded.

Read the full article...


Entity Framework: Insert, Update, Delete records

Every .NET developer sometime will start using ADO.NET Entity Framework.
And first question will be such as how to insert, update and delete records.
Performing basic Inser, Update and Delete operations via the Entity Framework is very straight forward.

Before you make any of thase operations you need to declare entyty

Read the full article...


Threading in .NET guide – Part 1

Hello my dear friend!

I'm starting the collection of articles about threading|multithreading programming in C# .NET.

Why now? I'm really wanted to write such collection year ago but as usually work is on the first place. I've got new experience in programming and ready to give materials for your brain in easiest way. So, please, be patient and I'll give samples to be understandable for beginners and for advanced.

Let's get the party!

Part 1 devoted to the introduction in threading.

I have read a lot of material dedicated to threading in .NET and finally want to share my knowledge and with the same way to learn something new. Next part I plan to give you after new year and can't say for sure it's going to be about. Probably it's going to be about Lifecycle of Threads or Synchronization. Just follow me on Tweeter and you'll be in touch with all updates! Read the full article...