Click here to Skip to main content
15,921,577 members
Home / Discussions / C#
   

C#

 
GeneralRe: SQL Database Connection Pin
Darkness8421-Mar-07 19:20
Darkness8421-Mar-07 19:20 
QuestionRe: Calculate and Display Prime Numbers Pin
chitra4sat21-Mar-07 18:05
chitra4sat21-Mar-07 18:05 
AnswerRe: Calculate and Display Prime Numbers Pin
sherifffruitfly21-Mar-07 18:11
sherifffruitfly21-Mar-07 18:11 
AnswerRe: Calculate and Display Prime Numbers Pin
Leslie Sanford21-Mar-07 18:33
Leslie Sanford21-Mar-07 18:33 
GeneralRe: Calculate and Display Prime Numbers Pin
chitra4sat21-Mar-07 19:27
chitra4sat21-Mar-07 19:27 
GeneralRe: Calculate and Display Prime Numbers Pin
Leslie Sanford21-Mar-07 19:37
Leslie Sanford21-Mar-07 19:37 
GeneralRe: Calculate and Display Prime Numbers Pin
chitra4sat21-Mar-07 19:48
chitra4sat21-Mar-07 19:48 
GeneralRe: Calculate and Display Prime Numbers Pin
Leslie Sanford21-Mar-07 20:00
Leslie Sanford21-Mar-07 20:00 
chitra4sat wrote:
but what are all the things have to be inside that class and let me know it by code.

becoz i have the output in the main program and all the funcctions are carried out there. but i have been asked that in the main program there should not be anything but we have to create the object and w ehave to call that method to display the output of the prime number.


You need to add a method to your PrimeNumClass. For example, in your Program class, you have a method named Main. When you run your console application, the application invokes your Main method.

So add a method to your PrimeNumClass. You need to give your method a name, return type, and specify its access. In addition you need to decide if your method takes any arguments. For example, below is a class with no methods:

namespace ClassDemo
{
    public class MyClass
    {
    }
}


Now, let's add a method to it that doesn't return anything and takes no arguments:

namespace ClassDemo
{
    public class MyClass
    {
        public void SayHello()
        {
            Console.WriteLine("Hello!");
        }
    }
}


The class now has a method called SayHello. If I want to use this class, I can create an instance of it and invoke the SayHello method:

MyClass mc = new MyClass();
 
mc.SayHello();


Based on what I've shown you here, add a method to your PrimeNumClass. Then put the code you have in your Main method into this method.
QuestionC# Automation Addin for Excel using ,NET - Build Error - Cannot Register Assembly (MSB3217) Pin
ralph_y21-Mar-07 17:58
ralph_y21-Mar-07 17:58 
QuestionHow to remove the rectangle from Propertygrid ? Pin
TaiZhong21-Mar-07 17:03
TaiZhong21-Mar-07 17:03 
AnswerRe: How to remove the rectangle from Propertygrid ? Pin
visualhint16-Apr-07 3:33
visualhint16-Apr-07 3:33 
Questionblock website function by enterring in texbox in a form.need help here Pin
krajah1021-Mar-07 15:26
krajah1021-Mar-07 15:26 
Questionthread question Pin
dino209421-Mar-07 14:51
dino209421-Mar-07 14:51 
AnswerRe: thread question Pin
Leslie Sanford21-Mar-07 17:02
Leslie Sanford21-Mar-07 17:02 
QuestionProgram structure need experienced programmers perspective please Pin
Mischievious21-Mar-07 14:36
Mischievious21-Mar-07 14:36 
AnswerRe: Program structure need experienced programmers perspective please Pin
Leslie Sanford21-Mar-07 17:05
Leslie Sanford21-Mar-07 17:05 
GeneralRe: Program structure need experienced programmers perspective please Pin
Mischievious21-Mar-07 18:14
Mischievious21-Mar-07 18:14 
QuestionQuestion about Windows Media Encoder Pin
Julianne_juju21-Mar-07 14:11
Julianne_juju21-Mar-07 14:11 
QuestionNeed help with XML config file Pin
Mark F.21-Mar-07 13:40
Mark F.21-Mar-07 13:40 
AnswerRe: Need help with XML config file Pin
coolestCoder21-Mar-07 18:31
coolestCoder21-Mar-07 18:31 
QuestionTrouble converting byte[] to bmp..... Pin
Are Jay21-Mar-07 12:17
Are Jay21-Mar-07 12:17 
AnswerRe: Trouble converting byte[] to bmp..... Pin
Nick Hodapp21-Mar-07 12:44
sitebuilderNick Hodapp21-Mar-07 12:44 
GeneralRe: Trouble converting byte[] to bmp..... Pin
Are Jay22-Mar-07 3:23
Are Jay22-Mar-07 3:23 
AnswerRe: Trouble converting byte[] to bmp..... Pin
Colin Angus Mackay21-Mar-07 13:00
Colin Angus Mackay21-Mar-07 13:00 
GeneralRe: Trouble converting byte[] to bmp..... Pin
Are Jay22-Mar-07 3:13
Are Jay22-Mar-07 3:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.