Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old May 10th, 2006, 12:34 AM
Registered User
Join Date: Apr 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default diff. between function and method

what is the difference between VB function and C# method?

Old May 11th, 2006, 01:47 PM
Authorized User
Join Date: May 2006
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts

Practically speaking, the difference is symantecs.

Note the declarations below:

VB, returns a value:
    Function fname (param1 AS <data type>, ...) AS <return type>

C#, returns a value:
    <return type> fname (<data type> param1, ...)

VB, does not return a value:
    Sub fname (param1 AS <data type>, ...)

C#, does not return a value:
    void fname (<data type> param1, ...)

In general, any code-structure that has a name and a parameter list (may be empty) can be referred to as a function. Any member of a class that can be referred to as a function can also be referred to as a method. In the .NET world, only VB makes the distinction between those that return a value (Function) and those that don't (Sub).

For more in-depth details, you might check out, "What is the Common Language Specification?" found at

If you really, really want to get into it, you could start reading about memory management, stacks, and heaps, or you explore the general theory of programming...


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with accessing function in pageload method nelly78 .NET Framework 2.0 5 September 8th, 2008 06:49 AM
What is the diff between ajax and callback method azymd777 ActionScript 0 February 28th, 2008 02:55 AM
Calling a function on every method call Takashi321 General .NET 1 September 21st, 2007 09:33 AM
Return DataTable from Web Method Function kasie ASP.NET 1.0 and 1.1 Basics 2 February 11th, 2004 06:23 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.