LA.NET [EN]

September, 2010Archive

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 »

Sep 04

Partial methods

Posted in Basics, C#       Comments Off on Partial methods

In previous posts, I’ve mentioned extension methods and how you can use them for extending existing types. After talking with a friend, I’ve noticed that I didn’t mention partial methods, which are really useful for code generators. Imagine you’re writing the code generator that needs to generate C# for some specs which are defined through […]

Read the rest of this entry »

Sep 03

If you’re a long time programmer/developer, then you probably expect to be able to create a parameter that receives a variable number of parameters.In C#, to declare a method that accepts a variable number of parameters you need to qualify the parameter with the params keyword. Here’s a quick example: static void PrintNames( params String[] […]

Read the rest of this entry »

Sep 02

What’s next?

Posted in Trivia       Comments Off on What’s next?

2011-01-12 15:31:01

Read the rest of this entry »

Sep 02

Parameters by reference

Posted in Basics, C#       Comments Off on Parameters by reference

By default, parameters are always pass by value. However, the CLR does allow you to pass parameters by reference. In C#, you can use the out or ref keywords for passing parameters by reference. When the compiler sees that you’ve used these keywords, it will emit code that passes the *address* of the parameter rather […]

Read the rest of this entry »

Sep 01

Parameters: by value or by reference? Say what?

Posted in Basics, C#       Comments Off on Parameters: by value or by reference? Say what?

I’m guessing that I won’t be giving any news when I say that parameters are used for passing values into methods. By default, parameters are passed by value. Here’s a quick example which will let us discuss this behavior: public class Student { public String Name { get; set; } public Int32 Age { get; […]

Read the rest of this entry »