Hi guys ,I have written a program which filter the text using replace function.What i want to do is to create another class and do all the filtering over there .How can i achieve this.I am pretty new to C# so any help would be appreciated.
Thanks
sadhawan
0
Light Poster
Recommended Answers
Jump to PostWhy don't you use a method instead of a class?
Add this above public Form1() { ...
string FilterText(string text) { // do all the filtering here }
And you can use it like this:
…string text = "Hello, World."; text = FilterText(text);
Jump to PostAnd if you really NEED to do it in another class, it'd just be an abstraction of what farooqaaa provided above but would require an appropriate constructor for the class object allowing pass-in of the string you're filtering.
All 7 Replies
farooqaaa
48
Enthusiast
Lusiphur
185
Practically a Posting Shark
Team Colleague
Featured Poster
sadhawan
0
Light Poster
Lusiphur
185
Practically a Posting Shark
Team Colleague
Featured Poster
Medalgod
7
Light Poster
sadhawan
0
Light Poster
Medalgod
7
Light Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.