Click here to Skip to main content
15,867,308 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Actually in my project for sending message concept i am using some code. same code i am using where ever i am sending the message in my project. so i want to decrease the repetition. is there any solution. now what i want is when ever i send the message.i should call one class file and i should pass the required parameters...
Posted
Comments
Surendra Adhikari SA 7-Jun-13 3:10am    
your question is self explaining .. that is you can decrease code repetition .you can make a class file and call its method .
Or in simple you can make a function or sub that send message and call it whereever you want.
ntitish 7-Jun-13 4:02am    
how to create a class file sir...if u dont mind can u explain
ridoy 7-Jun-13 3:16am    
it depends on your project requirements.
Nandakishore G N 7-Jun-13 5:27am    
right click on your project in solution explorer >> add new item >> class.cs you'll get the class file. write your code there and call the method by creating an instance of the class.
ntitish 8-Jun-13 2:43am    
Thanks sir ...

I would suggest you to read this: Best Coding Practices[^].

All you need to do is to create function/procedure for for these parts of code that are used many times to achieve the same thing.
 
Share this answer
 
Comments
_Amy 7-Jun-13 3:29am    
Exactly. +5!
Maciej Los 7-Jun-13 3:38am    
Thank you, Amit ;)
Surendra Adhikari SA 7-Jun-13 3:47am    
my +5
Maciej Los 7-Jun-13 3:52am    
Thank you, Rajan ;)
create public static class with Static Method
here static methad which u used everytime.
then u can access ur static method with sataic class name
 
Share this answer
 
Comments
ntitish 7-Jun-13 4:24am    
I mean from project where should i go to add the new class....
yourfriendaks 7-Jun-13 5:09am    
in project u add one class file make them as static
ntitish 7-Jun-13 6:17am    
can we take session parameter means session["UserID"]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900