TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Dinesh Santhalingam
NA
737
367.5k
How to return the value from a class ?
Jan 25 2017 2:00 AM
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using program1; //My progrm file
static void Main(string[] args)
{
program1.bike_details
details
=
new
bike_details (); //First class
program1.userdetails
datum
=
new
userdetails(); //second class
details.bikedata(@"D:\solution");
Console.WriteLine("Your output were extracted.......");
Console.WriteLine("Press any key to exit.......");
Console.ReadKey();
}
My first class file:
class bike_details
{
public string Nameofbike { get; set; } //Variable declaration
public int bikeIssued { get; set; }
public int currentusage { get; set; }
public void bikedata(string path)//Input from program
{
userdetails
udetail
=
new
userdetails();//My another class
string bikname;
int no of bike;
int currentbike;
//do something....
udetail.userdata(Nameofbike);
//get the elemnts from userdata and return it to main function
}
}
My Second class file:
class userdetails
{
public string UserId { get; set; }
public string Username { get; set; }
public void userdata(string nameofbike)//Input from class1
{
string userid;
string name;
//do something....
//Add it in a array and return the values
}
I have a main function.I have created two classes in separate file .Initially i sent the input for class1 from main function.And from there i sent a data to my second class,Where some operation performed and I want to get that data in class2 file in my current class and return to main function.Give me some guidance.
Reply
Answers (
2
)
Programmatically downloading file
C# Connect to SQL server using differnt window credential