tags:

views:

85

answers:

3

So since I'm still wanting to create a simple Pac-Man clone by December, I'm currently teaching myself C# in order to use the XNA Game Studio 3.1, which I find the best answer with readily available documentation to learn from as well as being kinda future-safe.

Anyway, the problem comes from a book I'm reading in which a function is declared as this:

public void TransformVectorByReference()>
{
    /* ...stuff... */
}

I'm assuming the internals aren't important, because the compiler is complaining about the ´>` symbol at the function declaration. However, multiple functions are declared like this and all of them are throwing errors of the type:

; expected.

Could anybody tell me what this function does/point me to a previous SO question because I'm not finding any answers via a search since I don't know what to call the funny thing.

The book I got this code snippet from is Sam's Microsoft XNA Game Studio 3.0. If anybody has any other, better alternatives to this book, I would be most happy to see them.

Edit:

I've added one example function, from three-five functions, that are almost identical, but one uses the > keyword. However, it was pointed out that this might not be the author's fault, but rather the way the book was produced/error-corrected.

public void TransformVectorByReference()
{
    Matrix rotationMatrix = Matrix.CreateRotationY( MathHelper.ToRadians(45.0f) );
    // Create a vector pointing the direction the camera is facing.
    Vector3 transformedReference;
    Vector3.Transform(ref cameraReference, ref rotationMatrix, out transformedReference);
    // Calculcate the position the camera is looking at.
    Vector3.Add(ref cameraPosition, ref transformedReference, out cameraTarget);
}

public void TransformVectorByReferenceAndOut()>
{   
    Matrix rotationMatrix = Matrix.CreateRotationY( MathHelper.ToRadians(45.0f) );
    // Create a vector pointing the direction the camera is facing.
    Vector3 transformedReference;
    Vector3.Transform( ref cameraReference, ref rotationMatrix, out transformedReference );
    // Calculate the position the camera is looking at.
    Vector3.Add( ref cameraPosition, ref transformedReference, out cameraTarget );
}
+13  A: 

The > is erroneous and should be removed.

Gary
Are you serious? The dude posted three, THREE functions with this! They are even identical with a slight modification to the function calls that he makes inside. I'll update this, but that is a piece of garbage if the author made such glaring typos.
SoulBeaver
It is invalid syntax as the compiler is telling you :) not necessarily the authors fault but it's sloppy editing at least.
Gary
+2  A: 

It looks like a typo to me although I haven't seen the book

Sruly
+1  A: 

The syntax is not valid, and since this appears in multiple places in the book, I would bet that the issue is not so much an author typo as a problem with the original markup and way the book was typeset. If the book has an accompanying CD or website you may be able to find the corrected code samples.

Ed Schembor