methods vs functions; types vs classes

I have been reading "C# in a nutshell" and it keeps using the terms functions and types.  Isn't a function the same thing as a method?  And isn't a type the same thing as a class?  I was reading another C# book earlier where it seemed to be just using the terms methods and classes...  :-S

Thanks :)
chilled2003Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
ptmcompConnect With a Mentor Commented:
When you're talking about C# a function is a method. But a type can be a class, a value type. The terms are used differently by different authors but usually you can figure out what is meant.
0
 
ptmcompCommented:
The terms function and type are used in procedural programming. In C# there are no functions outside of classes.
In C# every type is a class but class or a value type (struct). To make it more twisted there is even a class Type which holds the type information (Reflection).
Sample:

string a;

if (a is string) then
{
    // this condition is always true
}

if (a.GetType() == typeof(string))
{
    // this condition is true if a is not null else you'll get a nullreference exception
}
0
 
chilled2003Author Commented:
Thanks for the extra clarification :)

I have another question here if you would like to take a look at it as well...

http://www.experts-exchange.com/Programming/Programming_Languages/C_Sharp/Q_20778531.html
0
All Courses

From novice to tech pro — start learning today.