Calling the function in one cs from another cs file

  • Thread starter Thread starter yasodhai
  • Start date Start date
Y

yasodhai

Hi,
I have to call a function from one cs file to another. Kindly
provide me the link where I can go and search for the material
regarding this.


Regards,
Yasodhai
 
I have to call a function from one cs file to another. Kindly
provide me the link where I can go and search for the material
regarding this.

If you're calling a static method, just use
TypeName.MethodName(parameters);

If you're calling an instance method, you'll need an instance of the
type first, and then you can call
instance.MethodName(parameters);

However, this kind of question suggests that you're very new to C# - in
which case I'd recommend either getting a book or reading a C#
tutorial, rather than asking individual questions on the newsgroup.
Newsgroups give a great way of solving problems, but they're not a good
way of learning a language from scratch.
 
Jon Skeet said:
If you're calling a static method, just use
TypeName.MethodName(parameters);

If you're calling an instance method, you'll need an instance of the
type first, and then you can call
instance.MethodName(parameters);

However, this kind of question suggests that you're very new to C# - in
which case I'd recommend either getting a book or reading a C#
tutorial, rather than asking individual questions on the newsgroup.
Newsgroups give a great way of solving problems, but they're not a good
way of learning a language from scratch.

Maybe he could buy *your* book when it comes out. ;-)

Robin S.
 
Maybe he could buy *your* book when it comes out. ;-)

Of course you might suggest that - I couldn't *possibly* plug my own
book on the newsgroup... ;) You'll never, ever catch me doing that.
Honest. Did I mention that I co-authored "Groovy in Action"? :)

(Actually, it wouldn't be appropriate in this case anyway - I don't
intend to try to teach C# from scratch. Nice thought though.)

Jon
 
Jon Skeet said:
Of course you might suggest that - I couldn't *possibly* plug my own
book on the newsgroup... ;)

Your phrasing reminds me of a series they had on PBS years ago, "House of
Cards" was the first one. The guy in it leaked info to a reporter while
trying to inveigle his way into the Prime Minister job, and would hint at
stuff, and she would guess, and he would say, "*YOU* might say that, but
*I* couldn't possibly comment."
You'll never, ever catch me doing that.
Honest. Did I mention that I co-authored "Groovy in Action"? :)

(Actually, it wouldn't be appropriate in this case anyway - I don't
intend to try to teach C# from scratch. Nice thought though.)

Jon

I think it's okay to plug your own book on the newsgroup, as long as you're
not rude about it. "I could give you this answer, but I won't. Go buy my
book."

I searched for you on amazon, and came with "Java Persistence with
Hibernate" (which it looks like you reviewed) and "Windows Powershell in
Action" (no idea why, don't see your name anywhere), but not "Groovy in
Action". So I looked that up, and you're nowhere to be found. Oh, wait,
there you are at the very bottom of the page listed at the end of the
author list.

You might want to get your name in a more prominent position on the next
book you write. ;-)

Robin S.
 
RobinS said:
Your phrasing reminds me of a series they had on PBS years ago, "House of
Cards" was the first one. The guy in it leaked info to a reporter while
trying to inveigle his way into the Prime Minister job, and would hint at
stuff, and she would guess, and he would say, "*YOU* might say that, but
*I* couldn't possibly comment."

There's a reason that's similar - the phrase ran through my head when
writing the reply. The first version of my reply was even more similar.

The first two series of the trilogy were some of my favourite dramas
before I encountered The West Wing. Shame about "The Final Cut" which
was terrible. It was a great pity when Ian Richardson died earlier this
year.
I think it's okay to plug your own book on the newsgroup, as long as you're
not rude about it. "I could give you this answer, but I won't. Go buy my
book."

:) I suspect I'll plug it mildly where relevant - so long as it doesn't
become annoying.
I searched for you on amazon, and came with "Java Persistence with
Hibernate" (which it looks like you reviewed) and "Windows Powershell in
Action" (no idea why, don't see your name anywhere)

I reviewed Powershell in Action at an early stage. I blogged about it
too. The chapters I read were great.
but not "Groovy in Action". So I looked that up, and you're nowhere
to be found. Oh, wait, there you are at the very bottom of the page
listed at the end of the author list.

You might want to get your name in a more prominent position on the
next book you write. ;-)

To be honest, I didn't do a huge amount for Groovy in Action - I was
somewhere between author and editor, mostly polishing existing text and
occasionally adding bits where it wasn't clear enough. Sometimes Amazon
includes my name in the book page, sometimes I'm just one of "et al" :)
 
Jon Skeet said:
There's a reason that's similar - the phrase ran through my head when
writing the reply. The first version of my reply was even more similar.

The first two series of the trilogy were some of my favourite dramas
before I encountered The West Wing. Shame about "The Final Cut" which
was terrible. It was a great pity when Ian Richardson died earlier this
year.


I agree. And I liked the third entry in the trilogy, but the first two were
definitely the best. Ian Richardson was also great in "Dark Rooms", as a
mentor to Arthur Conan Doyle. Very "Sherlock Holmes-y".

:) I suspect I'll plug it mildly where relevant - so long as it doesn't
become annoying.

I'm sure people will let you know.

Have fun,
Robin S.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top