Solved

methods vs functions; types vs classes

Posted on 2003-10-26
3
171 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VB.NET 2008 - SQL Timeout 9 51
Please explain purpose of GZIP 4 62
I need help adding validation to my MVC.Net view 6 23
Build a string of emails from a gridview 2 20
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

696 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