LA.NET [EN]

2010Archive

Dec 22

Christmas is here

Posted in Uncategorized       Comments Off on Christmas is here

So, it’s time to wish a Merry Christmas and a Happy New Year!

Read the rest of this entry »

Nov 23

In the previous two posts, I’ve presented the basics (and some gotchas) associated with the way you declare events. In this post, I’ll present an alternative way for exposing events which is useful when you’re creating a class which has lots of events. In order to understand how this strategy works, we need to make […]

Read the rest of this entry »

Nov 23

In one of the previous posts, we’ve looked at the basics associated with .NET events. As promised, we’ll start improving our initial code and today we’ll talk about two topics: lambdas aren’t always your friends. we live in a multithreaded world. Lets start with number 1…In the previous code, I’ve uses something like this to […]

Read the rest of this entry »

Nov 17

Better late, than never, right? I’m happy to announce that my Silverlight book’s code is (finally) online. If you’ve bought the book, then you can head to FCA’s site and download it from the book’s page. Sorry for the delay…

Read the rest of this entry »

Nov 16

Getting started with events

Posted in Basics, C#       Comments Off on Getting started with events

I guess we all know about events, right? Even so, I’ve decided to write a couple of posts about it and today I’ll be talking about some basic stuff associated with event definition and usage. So, what is an event? An event allows a type to notify other objects about something special which happened. If […]

Read the rest of this entry »

Nov 03

Do you want to help me with my next book?

Posted in Books, HTML5       Comments Off on Do you want to help me with my next book?

Yep, I’ve already decided: I’ll be writing an intro book on HTML 5 (in Portuguese, of course). YEs, I just couldn’t resist it: ,,) I think HTML 5 is such a cool platform that I could resist writing a small book about it. But this time, I want to try something new: I want to […]

Read the rest of this entry »

Oct 28

Zebra code available online

Posted in C#       Comments Off on Zebra code available online

A few years ago, I’ve written a couple of helper classes for printing labels for those funny Zebra printers. At the time, I’ve targeted the TLP2844 model, but the code should work with any printer which understands EPL2. There was a problem with my ISP provider  which resulted in a delete of the rar file […]

Read the rest of this entry »

Oct 27

The dynamic type

Posted in Basics, C#       Comments Off on The dynamic type

C# 4.0 introduced a new type whose main job is to simplify our job when writing code that needs to use reflection. I’m talking about the new dynamic type. As we all know, C# is type-safe programming language. In practice, this means that the compiler must resolve all expressions into types and their respective operations. […]

Read the rest of this entry »

Oct 25

In the previous post, we’ve started looking at the Equals method and saw that its default implementation (inherit from Object) had some flaws. We’ve seen a better implementation for it and we’ve also talked about some strategies for overriding the method in new custom types. In this post, we’re going to talk about a somewhat […]

Read the rest of this entry »

Oct 24

Yep, it’s true: I’m still alive! After a long pause on blogging (due to a future project which I’ll talk about in a future post), I’m back…And with a very interesting topic. Comparison between objects is something which developers tend to do a lot. By default, all objects inherit the Object’s Equals virtual method, which […]

Read the rest of this entry »

Oct 01

It seems like MS renewed my ASP.NET MVP status for another year. Thanks MS!

Read the rest of this entry »

Sep 29

Protected: My Silverlight book is out!

Posted in Books       Enter your password to view comments.

There is no excerpt because this is a protected post.

Read the rest of this entry »

Sep 22

Back to methods: overloading

Posted in Basics, C#       Comments Off on Back to methods: overloading

After a small JavaScript detour, I’m back into .NET land. We’ve already seen several interesting details regarding methods, but we still haven’t really discussed the concept of overloading. So, what’s method overloading? The concept is simple, but before, we should probably find a good enough definition for a method. For now, lets define a method […]

Read the rest of this entry »

Sep 22

Oh damn! Can’t you see that’s a constructor?

Posted in Javascript       Comments Off on Oh damn! Can’t you see that’s a constructor?

Even though I’ve been in Silverlight/C#/WCF land in these last months, the truth is that I’ve always been a JavaScript aficionado. In fact, if you’ve been reading my blog, you’ll probably recall a small series I’ve done on it a few months ago(if not, then don’t worry: you can still read it here). After speaking […]

Read the rest of this entry »

Sep 20

Operator overloading

Posted in Basics, C#       Comments Off on Operator overloading

In some languages (ex.: C#), you can customize the way an operator works. For instance, if you take a look at the String type, you’ll notice that it has these peculiar looking methods: public static bool operator !=(string a, string b); public static bool operator ==(string a, string b); What you’re seeing here is known […]

Read the rest of this entry »

Sep 17

After a few months of  using the Paste from Visual Studio plug-in for copying code from VS to Windows Live Writer, I think I’ve found something better for this sort of thing. It’s called Paste as Visual Studio Code and I do like the way it works. The best thing  about it is that it’s […]

Read the rest of this entry »

Sep 17

In the previous posts, I’ve presented the basics on boxing and unboxing. Today, we’ll take a deep dive into several scenarios which illustrate how boxing/unboxing can occur without you even noticing it. Lets start with a quick recap. Suppose we’ve got the same structure as used in the previous examples: public struct Student {     public […]

Read the rest of this entry »

Sep 16

Unboxing: is it really the opposite of boxing?

Posted in Basics, C#       Comments Off on Unboxing: is it really the opposite of boxing?

[Update: Thanks to JPC for finding (yet!) another error in my post] Yes…well, it is, but it’s cheaper (as we’ll see). As we’ve seen in the previous post, we can convert a value type instance into a reference type instance through an operation known as boxing. Unboxing lets you convert a reference type into a […]

Read the rest of this entry »

Sep 16

Value types and boxing

Posted in Basics, C#       Comments Off on Value types and boxing

As we’ve seen, value types have better performance than reference types because they’re allocated in the stack, they’re not garbage collected nor do they get the extra weight generally associated with reference types. There are, however, some times where we need a “reference to  a value object” (yes, I wanted to write “reference to a […]

Read the rest of this entry »

Sep 15

The DOCTYPE element

Posted in HTML5       Comments Off on The DOCTYPE element

One of things I’ve been doing lately is reading the HTML 5 spec.  Before you tell me to sod off, don’t forger that HTML 5 is here…to stay, I’d say! Yes, there’s still no final version and the RC is only planed for 2012, but  the thing is that most browsers are implementing the current […]

Read the rest of this entry »

Sep 15

One of the books I’ve re-read during my August vacations was Don Box’s Essential .NET. Tentatively called Essential .NET, Volume I: the Common Language Runtime (I say tentatively because there never was a volume II), it’s really one of those interesting books which you need to read for understanding and having some background on how […]

Read the rest of this entry »

Sep 15

[Update: thanks to Wesner, I’ve fixed the list you should consider when using value types] In the previous post, I’ve talked about some basic features related with reference types. If all the types were reference types, then our applications would really hurt in the performance department. In fact, hurt is really a kind way of […]

Read the rest of this entry »

Sep 14

Still on types: reference types

Posted in Basics, C#       Comments Off on Still on types: reference types

Most types introduced by the framework are reference types. So, what is a reference type? Take a look at the following code: Student std = new Student(); When you instantiate a reference type you end up with a…yep, that’s right: a reference to the instantiated object. Notice that I said reference, not pointer. People tend […]

Read the rest of this entry »

Sep 13

After a bad week (where my work machine died), I’ve finished reinstalling everything. This time, I’ve went with Windows 7 and as a bonus, I’ve ended up with IIS 7.5. One of the things I needed to recover my working environment was to configure access to the certificates’ private keys (I have several WCF services […]

Read the rest of this entry »

Sep 10

Checked vs unchecked operations

Posted in Basics, C#       Comments Off on Checked vs unchecked operations

In the previous post, I’ve introduced the concept of primitive type and we’ve seen how they’re treated in a special way by the compiler. One interesting topic that pops up when we talk about primitive types is operation overload. For instance, what happens when you try to run the following snippet: var max1 = Int32.MaxValue; […]

Read the rest of this entry »

Sep 09

An intro on types: primitive types exist!

Posted in Basics, C#       Comments Off on An intro on types: primitive types exist!

If you’re not new to .NET, you’ve probably heard several times that one type can be a value type or a reference type. Well, that is true. What people miss (sometimes) is that they’ve also got some data types which are used so often that compilers allow code to treat them in a simplified way: […]

Read the rest of this entry »

Sep 07

Friend assemblies

Posted in Basics, C#       Comments Off on Friend assemblies

In the previous post, we’ve seen the difference between type visibility and member accessibility. A type can be visible to all the other types defined in the same assembly (internal) or it can be visible to any type, independently from the assembly where it’s defined. On the other hand, member accessibility controls the exposure of […]

Read the rest of this entry »

Sep 06

Type visibility vs member accessibility

Posted in Basics, C#       Comments Off on Type visibility vs member accessibility

One of the things I’ve noticed while trying to help others get started with the .NET framework is that they tend to confuse type visibility with member accessibility. In this quick post I’ll try to point out the differences between these two concepts. Let’s start with type visibility. When you create a type (ex.: class, […]

Read the rest of this entry »

Sep 06

Partial classes

Posted in Basics, C#       Comments Off on Partial classes

In the previous post, I’ve talked about partial methods and I’ve promised that the next post would be about partial classes. And here it is! Now that I think about it, I should have written this post before the one on partial methods, but this order will have to do it now, won’t it? The […]

Read the rest of this entry »