Question: I'm just thinking if there is any way how to get information about element in HTML in my .NET application.
The input is HTML page and path to CSS files etc. I want to take e.g. H1 tag and found what will be the CSS for it. Is there any code or can I use IE and try to take this information from it automatically inside of my application?

Answer: 
Given:

```
- (void)setPlanetName:(NSString *)value {
    if (planetName != value) {
        [planetName release];
        planetName = [value copy];
    }
}

```

The `-copy` ensures that if someone passes in an instance of `NSMutableString` as `value`, then `planetName` won't change in your instances out from under you.

A good defensive programming pattern. Note that `-copy` is free on immutable strings; `-copy` just bumps the retain value and returns self (the instance of the string that was copied).

Now, consider your second example:

```
- (void)setPlanetName:(NSString *)value {
    if (planetName != value) {
        [planetName release];
        planetName = [value retain];
    }
}

```

Perfectly valid and works fine, just not as defensive.

**In both cases, `planetName` must be released in your `-dealloc` method**.

```
- (void) dealloc
{
    [planetName release];
    planetName = nil; // defensive
    [super dealloc];
}

```

It doesn't matter if the string is copied, retained, or was originally a constant string that was passed into your setter. If you retain it (or implied retain it through copy), you must release it.

Note that you can think of this as "escape patterns". Whenever the existing value of planetName escapes your object, you must release it. That can happen when the object is deallocated or when a new value of planetName is set, hence the -release in the setters.

Or, if on Mac OS X, you could turn on garbage collection and be done with it. In any case, you should be using @property & @synthesize to automatically generate the getter/setter pair.
in the class's dealloc method, there should be another [planetName release] there, which will handle releasing of any instance variables. If that is present then there is no memory leak to worry about.

As for your other question, yes copy is used if you potentially have a mutable object that you don't want to allow other code to be able to modify what your class expects. You are expected to release any object that you call copy on, as it returns something with a retain count of 1. Also, in the case of immutable objects (like NSStrings vs. NSMutableStrings) copy just calls retain since there is no need to make a full copy of something that is immutable.