|
Whilst your question is not absolutely clear, can I suggest that you look at TabConrol Class[^].
If that does not help, please come back, and if you could find a way to reword your question, it might make it easier for others to help you.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hi Friends,
Are Methods and Functions the similar thing? I mean, are they same. I surfed the net and on some forum I found this definition, which I modified: "Methods are in-built whereas Functions are user-defined, in a programming environment". Is this definition correct to some extent? I mean, it would have been very nice of you all, if you guys could provide me an advanced definition for this. And please say, whether the same definition work out for both OOP and other non-OOP HLL language.
Thanks in advance,
Help would be appreciated,
Rajdeep
I calculate my days on earth..... approximately 55 years remaining for me to expire
|
|
|
|
|
|
In my mind, a method is a named block of code which may accept an input, usually performs an action, and may either alter the input, return output, or both. A function is a method which returns output. These are just working definitions, so may not be technically correct. They just work in most scenarios
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
Hi freak!
Well, thanks for the definition man. Actually, in C#, the concept of methods and functions are eventually different, whereas, in Java, theres no concept of functions. Only methods.
Well, suddenly I was struck with the lightening of knowledge
The stuff also can be defined like: "A method can be declared within a function, however, its not possible to declare functions within a method". How's that? Silly aint it? Does this make any sense. Do let me know!
I calculate my days on earth..... approximately 55 years remaining for me to expire
|
|
|
|
|
That doesn't make any sense. I've already said how I view methods and functions to be different, how is this inaccurate - it implies that functions and methods are different, with functions being a subtype of methods
The definition you gave is odd. If I declared some C# code like so:
public int Function()
{
private void Method()
{
}
} It wouldn't compile AFAIK (not got access to csc, so can't check). The same point applies to the second clause of your sentence.
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
Indeed, C-like languages can't do that. (Probably for good reason.)
|
|
|
|
|
They are really just terms for the same thing, but...
Pascal makes the following distinction:
A function returns a value, and does not alter the parameters (if any) -- x = ABS(y)
A procedure does not return a value, but does alter the parameters -- CLOSE(f)
C (and its descendants) don't really make that distinction, so a function may alter the parameter and return a value -- e = CLOSE(f)
** Although allowed by the language, many practitioners frown on "functions" that have "side-effects", regardless of the language in use. **
With Object Oriented Programming, functions that are part of a class (or struct) are called methods.
Unlike C++, C# enforces OOP so all functions must be part of a class, and are therefore methods.
If you choose, you may write methods that conform to the above definition of "function" or "procedure"
Likewise, in C# some methods are properties, some are indexers, etc.
|
|
|
|
|
How about static functions/methods then? Math.Abs doesn't really care that it happens to be in Math, and you're not even passing a pointer to Math as implicit first parameter either.
|
|
|
|
|
static nethods (IMO) are more like functions.
Functions = Sledge Hammer that does what it says on the tin.
Methods = More subtle to massage and manipulte fields/properties/data
Obviously these can be interchanged but...
BTW, I hesitated to reply on this thread. You do recognise the OP? Encouragement is probably not a good idea!
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Uh, yeah? So?
If they belong to a class they're methods, big fat hairy deal.
|
|
|
|
|
That's not what I learned at school
that was: methods operate on an object, functions don't.
That makes static functions functions.
For you it only seems to matter where they are written and not what they actually do.
But a quick search on google reveals that the opinions of The Masses are pretty much divided into those two trains of thought.
It's not like it actually matters though, a rose by any other name would smell as sweet
|
|
|
|
|
harold aptroot wrote: It's not like it actually matters though, a rose by any other name would smell as sweet
Absolutely.
I sit corrected; the C# spec says:
"
7.4 Function members
Function members are members that contain executable statements. Function members are always members of types and cannot be members of namespaces. C# defines the following categories of function members:
• Methods
• Properties
• Events
• Indexers
• User-defined operators
• Instance constructors
• Static constructors
• Destructors
"
So as far as C# is concerned, "function" is a rather generic term. I had been using the term "member" for that meaning.
However, I still feel that we need to consider non-OOP and "multi-paradigm" languages when discussing this topic. Pascal clearly has function s and procedure s, C has only functions (as a concept, not as a keyword), C++ has functions and members.
The purpose of defining such concepts and terminology is so we may communicate.
|
|
|
|
|
Anybody knows what happened to subroutines?
and procedures?
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Subroutines can't take parameters.
Procedures may remove your spleen.
|
|
|
|
|
All these replies and no one nailed it: Methods are functions associated with a class.
A function is more general; all methods are functions, but not all functions are methods.
In C# non-method functions aren't allowed because each function must be associated with a class.
|
|
|
|
|
Something I just discovered is that adding rows goes much faster if a sort has been applied first (setting the SortedColumn and SortOrder properties). I commented out those lines to see if they were needed for something else, and an (excessively) large set of input data I was using for performance/stress testing went from taking 25sec to load to over 200 sec.
Does anyone know *why* this is happening?
The European Way of War: Blow your own continent up.
The American Way of War: Go over and help them.
|
|
|
|
|
I want to write IVR. But the pattern is used.
|
|
|
|
|
|
You already wrote "IVR" twice. I fail to see the problem ...
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
Help.
Has anyone managed to get GnuPG working from C#?
I have installed the latest version of GnuPG and downloaded the wrapper GnuPGWrapper from this site.
I've created a new registry key called HomeDir in HKEY_CURRENT_USER\Software\GNU\GnuPG with a value
of "C:\Program Files\GNU\GnuPG\" the gpg.exe and keyring files are also in this location.
When I run my simple console application I get this error.
"Emmanuel.Cryptography.GnuPG.GnuPGException was unhandled
Message="gpg: keyblock resource `C:/Program Files/GNU/GnuPG\" --yes --batch --encrypt --armor --recipient crypto@turpin-distribution.com --default-key crypto@turpin-distribution.com --passphrase-fd 0 --no-verbose \\secring.gpg': file open error\r\ngpg: keyblock resource `C:/Program Files/GNU/GnuPG\" --yes --batch --encrypt --armor --recipient crypto@turpin-distribution.com --default-key crypto@turpin-distribution.com --passphrase-fd 0 --no-verbose \\pubring.gpg': file open error\r\ngpg: no valid OpenPGP data found.\r\ngpg: processing message failed: eof\r\n"
"
Has anyone got a working example of this that they would be kind enough to post as I've now pulled all my hair out
My console application looks like this..
using System;
using Emmanuel.Cryptography.GnuPG;
namespace FileSystemExample
{
class FileExample
{
public static void Main()
{
string inputText;
string outputText;
GnuPGWrapper gpg = new GnuPGWrapper();
gpg.command = Commands.Encrypt;
gpg.homedirectory = @"C:\Program Files\GNU\GnuPG\";
gpg.passphrase = "fred";
gpg.originator = "crypto@turpin-distribution.com";
gpg.recipient = "crypto@turpin-distribution.com";
inputText = "Hello World";
gpg.ExecuteCommand(inputText, out outputText);
Console.WriteLine("Input = {0}, Output = {1}", inputText,outputText);
}
}
}
|
|
|
|
|
Seems like the main error is the following:
davidmgray_de wrote: file open error
davidmgray_de wrote: no valid OpenPGP data found
Have you tried the vendors website?? They might have better support on this product or have documentation available on how to use this.
Excellence is doing ordinary things extraordinarily well.
|
|
|
|
|
Good morning.
I am trying to remove any special characters in a string I pass.
I came across this code:
using System.Text.RegularExpressions;
string = Regex.Replace(string, @"[^\w\.]", "");
It appear to work very well, except it doesn't "filter" out the underscore (_)character for some reason.
I was hoping someone could help me better understand what the
@"[^\w\.]", does and how I can add or remove something to filter out the underscore.
Thank you, WHEELS
|
|
|
|
|
Try @"[^_\w\.]"
The regexp is actually just the this [^\w\.] - this is a character class (because its in []). The ^ immediately after [ says exclude any chars in the class. The \w says any char that is a word char (roughly letters and digits) and the \. says period. The \ are escapes w by itself matches the letter w and . by itself matches any char.
The @ is used in C# to prevent it processing \ as an escape in a string literal - without it you would have to use "[^\\w\\.]".
There's some good stuff to be found by googling for 'regular expressions c#'
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
|
|
|
|
|
Thank you riced.
Any idea on how to rid the string from the (_) underscore?
WHEELS
|
|
|
|