Solved

methods vs functions; types vs classes

Posted on 2003-10-26
3
172 Views
Last Modified: 2010-04-16
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 :)
0
Comment
Question by:chilled2003
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 10

Expert Comment

by:ptmcomp
ID: 9623777
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
 
LVL 10

Accepted Solution

by:
ptmcomp earned 50 total points
ID: 9623786
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
 

Author Comment

by:chilled2003
ID: 9623815
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

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question