- 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();
- }
How to return the value from a class ?
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
- }
Sibiraj ThattalamPosted Jan 25, 2017, 9:03 AM
Piyush PansuriyaPosted Jan 25, 2017, 5:54 AM