tags:

views:

37

answers:

5

I am having a 'learning' day and am delving into an ASP.NET solution to try and learn more advanced techniques for building apps (I'm still in novice stage so please can you answer as if I am stupid :)... lol).

And I have a couple of questions...

1.) Looking through the code I see this method

public interface Somthing()

I have never seen 'interface' before? What is it used for? And could you point me in the right direction to find out more about using it

2.) I keep seeing things like this in the comments

<see cref="CoComment"/>

I'm not sure what this means?

Any help greatly appreciated

A: 

I don't know of an interface modifier on a method, and have just Googled and can't see anything.

Could it be a badly cased (and named!) return type?

ie. should it have been:

public Interface Something();

as in it is returning an object of type Interface?

Program.X
A: 

You can think of an interface as an abstract class that only provides constant and method prototype declarations. Classes can then implement interfaces in the same way they can inherit from other classes. When implementing an interface, a class must implement all methods defined in the interface:

public interface MyInterface
{
    void doSomething();
}

public class MyClass : MyInterface
{
    public void doSomething()
    {
    }
}

MyInterface obj = new MyClass();
obj.doSomething();

One of the nice things about interfaces is that they support multiple inheritance, unlike classes in .NET. So you can implement several interfaces and interfaces can extend several other interfaces.

The naming convention for interfaces in .NET is 'ISomething', so you can guess that a symbol is an interface if it starts with an 'I'. Moreover, many interfaces have names that end on '-able', like 'IDisposable' or 'ICloneable'.

The concept is the same as in Java, you can read more about it on Wikipedia.

Ferdinand Beyer
+1  A: 

Sorry, missed your edit regarding comments.

You can create XML documentation using the /// comment token.

So you can have:

/// <summary>
/// Does something
/// </summary>
/// <see cref="something" />
public void DoSomething()
{
}

This can then be used to produce API documentation, much like MSDN format. It also comes through in Visual Studio Intellisense tooltips which I find very useful.

Program.X
A: 

Here's the help for cref:

http://msdn.microsoft.com/en-us/library/cc837134.aspx

Will Dean
A: 

1) interface see: http://msdn.microsoft.com/en-us/library/87d83y5b(VS.80).aspx

2) <see ...? XML Documentation markup see: http://msdn.microsoft.com/en-us/library/5ast78ax(VS.71).aspx

AnthonyWJones