Here I have a sample code in which i am creating the instances of the class and passing more than one time as a parameter. The thing that is bothering me, is why I have to create multiple instances of a single class in all saperate methods is there any possible way to avoid the repetiton of codes.
-   public void method1()
- {
-    class1 cl= new class1();
 
-    c1.filldata();
 
-    method2(c1);
 
- }
- public string method2(class1 c)
- {
-    class1 c2= new class1();
 
-    c2=c;
 
-    string data =c2.data;
 
- }
 Here in the above code snippet i have instantiated two instance of a class which i want to avoid.
 
NOTE: I can not use parametrised class object that is passed to method2. This is because i need  a new object.