Everything if here: http://www.ubucentrum.net/2010/01/gadu-gadu-i-import-kontaktow-w-empathy.html
Make fun :)
A few words about me, things I'm interested in and other more or less useful things...
Saturday, April 17, 2010
Monday, April 12, 2010
Sunday, April 11, 2010
Black Saturday :/
No comments needed... only silence and silent prayers and hope that everything will be OK...
link
link
Sunday, March 21, 2010
Some strange optimization of the C# :D
Sometimes optimization mechanism build in the compilator is able to do some strange things. For example when the following code is concerned we think than reference var1 is not equal the var2 reference.
string var1 = "text";
string var2 = "text";
bool condition = object.ReferenceEquals(var1, var2);
But the optimizer of the C# "thought" that it is not needed to create some new reference on the management heap and it uses the local one.
When we make a little change in the previous code, for example modify the second string by adding the "t" letter at the end of it after its initialization
string var1 = "text";
string var2 = "tex";
var2 += "t";
bool condition = object.ReferenceEquals(var1, var2);
then the references will not be eqal.
This could be a cause of a huge set of problems in the real programming world, so take care about it :)
string var1 = "text";
string var2 = "text";
bool condition = object.ReferenceEquals(var1, var2);
But the optimizer of the C# "thought" that it is not needed to create some new reference on the management heap and it uses the local one.
When we make a little change in the previous code, for example modify the second string by adding the "t" letter at the end of it after its initialization
string var1 = "text";
string var2 = "tex";
var2 += "t";
bool condition = object.ReferenceEquals(var1, var2);
then the references will not be eqal.
This could be a cause of a huge set of problems in the real programming world, so take care about it :)
Nullable values in the C# language
Nullable value = 5;
value = null;
System.Diagnostics.Debug.Assert(value == null);
or
int? value = 5;
value = null;
System.Diagnostics.Debug.Assert(value == null);
Clear and easy, doesn't it? :)
value = null;
System.Diagnostics.Debug.Assert(value == null);
or
int? value = 5;
value = null;
System.Diagnostics.Debug.Assert(value == null);
Clear and easy, doesn't it? :)
What's new in C# 4.0
Spending time on doing nothing I have found a really god article about some news in the 4-th version of C# which I would like to present in this post. Especially I have ben interested in one construction in particular which allows the programmer invoking some method for the all elements of a collection in the pararell way. It looks like the following one:
string []tab=new string[]{"a","b","c","d","e"};
System.Threading.Tasks.Parallel.ForEach(tab, Method);
where
private static void Method(string val)
{
}
string []tab=new string[]{"a","b","c","d","e"};
System.Threading.Tasks.Parallel.ForEach
where
private static void Method(string val)
{
}
Subscribe to:
Posts (Atom)