Enumerations, bitwise operators and flags
Ημερομηνία: 16.07.2017
Σχόλια : 0
Enumerations are a simple and efficient way to deal with a set of values. The most common way to use an enumeration is to use its values separately. There are however times when we want to use a combination of the enumeration's values. In that case we can use bitwise operators. To make things easier, we can also use flags.
Enumeration
Let's start using...
Getting random values
Ημερομηνία: 14.05.2017
Σχόλια : 0
You do not have to be working on some gambling project in order to request for a random number. Things like that happen all the time. Either you may need to pick a random product to show out of a list or you may want to present some results randomly ordered. Anyway, getting a random number is something you will need to do from time to time. To get a random number we may use the Random or the RNGCryptoServiceProvider...
Yield and iterator methods
Ημερομηνία: 05.04.2017
Σχόλια : 0
All around C#, there are over a few dozen keywords. One of them, which is rarely used and is sometimes misunderstood, is yield. However, if used properly, yield can help in optimizing your code. Let's take a look at how it works.
What does yield do?
Let's get to what yield does using an example. We are going to create a method that returns a Fibonacci sequence....
Session in ASP.NET MVC applications
Ημερομηνία: 20.11.2016
Σχόλια : 0
Session is a simple and nice way to store info in memory and has been used in ASP.NET for a long time. Since MVC came out, there were many people out there saying that session should be abandoned and replaced by other methods while others said that there is no problem using session the way we used to. As this may confuse developers that are not highly experienced in MVC, let's see what actually...
Boolean types - To null or not to null?
Ημερομηνία: 28.05.2016
Σχόλια : 0
Boolean types are quite common to be found within a database. Alike many other types there are boolean and nullable boolean types. Simple boolean types consist of two values: True and False. Nullable ones offer null as a third choice. So, do we really need this third option in our database or source code and if so how should we deal with it?
Nullable types
Nullable...
Shorten your URLs using goo.gl
Ημερομηνία: 10.04.2016
Σχόλια : 2
Shortened URLs have slowly turned into one of the latest trends. Even though it's been about 15 years they've been helping people having difficulty with limited character messaging applications and SMS, social networks sharing such limitations have caused some major increment in their use. We are going to see what shortened URLs are, and how we can create our own, using goo.gl API.
What...
Shallow and deep copying objects
Ημερομηνία: 27.02.2016
Σχόλια : 0
Working as a developer I have created quite a lot of objects. Most of them were unique. There were some of them, however, that were created by copying already existing objects. C# provides us with a few techniques to accomplish this, keeping in mind whether we want to create a copy that keeps all data the prototype had, or how to deal with the referenced types contained within that object.
Shallow...
Choosing between fields, properties and methods
Ημερομηνία: 07.02.2016
Σχόλια : 0
I once told a friend of mine that programming is much like chess. In some cases it is; for example when you know where you want to get but there are so many paths to follow. Choosing between fields, properties and methods when you want to store a value temporarily or retrieve it, can be described as some of these scenarios. There was a time I created a class and wanted to store some data, but...
Deferred execution on LINQ to Entities
Ημερομηνία: 01.11.2015
Σχόλια : 0
Many people use entity framework but are not aware of what deferred execution is and how it may affect their projects. In this article, we are going to have a little talk about it and see how things work.
LINQ to entities and deferred execution
We take into account that we all have some understanding of entity and LINQ or lambda expressions.
To...
Create a secure socket layer WCF service
Ημερομηνία: 21.09.2015
Σχόλια : 0
We have already seen how to create a WCF service. This time we are going to see how to combine a WCF service with SSL security, which will be a trickier thing to do.
To reach our goal, we need to take three steps. Step one is to create a WCF Service. Step two is to install a certificate for authentication. Step three is to bring the two first steps together. Since creating...