In what scenario we need to create Static Class?
Interview question-: Why we need to create a Static Class, why shouldn't we create a normal class instead of that. Real world example to explain.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Tapan PatelRank #614 · 3.9K reputationPosted Aug 11, 2016, 7:37 AM EDT
Tapan PatelRank #614 · 3.9K reputationPosted Aug 11, 2016, 7:23 AM EDT
Midhun TpRank #388 · 6.5K reputationPosted Aug 11, 2016, 7:27 AM EDT
Anil ThakurRank #1,015 · 1.9K reputationPosted Aug 11, 2016, 7:29 AM EDT
Anil ThakurRank #1,015 · 1.9K reputationPosted Aug 11, 2016, 7:41 AM EDT
Tapan PatelRank #614 · 3.9K reputationPosted Aug 11, 2016, 7:45 AM EDT
Anil ThakurRank #1,015 · 1.9K reputationPosted Aug 11, 2016, 7:49 AM EDT
Tapan PatelRank #614 · 3.9K reputationPosted Aug 11, 2016, 8:01 AM EDT
Anil ThakurRank #1,015 · 1.9K reputationPosted Aug 11, 2016, 8:05 AM EDT
Tapan PatelRank #614 · 3.9K reputationPosted Aug 11, 2016, 8:10 AM EDT
Anil ThakurRank #1,015 · 1.9K reputationPosted Aug 11, 2016, 8:23 AM EDT
Tapan PatelRank #614 · 3.9K reputationPosted Aug 11, 2016, 9:25 AM EDT
Anil ThakurRank #1,015 · 1.9K reputationPosted Aug 11, 2016, 9:47 AM EDT
Tapan PatelRank #614 · 3.9K reputationPosted Aug 11, 2016, 10:22 AM EDT
Consider the example of TFS Work Items management using C# programming. I mean through code.
If you have a requirement to write a classes (separate classes ) that deals with TFS User Story, TFS Bugs, TFS Project, think something that is common in all above classes and you will have to do no wonder what to deal with TFS items.
Connection to TFS Work Items. Also, reading the any of the work item from TFS is a common Task.
So , you can define the Abstract class which has implementation of Connecting to TFS Server, and it also has implementation of Reading the work item of type you can pass as parameter.
Let’s say the method is : List ReadTFSItem(string ItemType, int ItemNumber) . And this method return the Title and Description of the work item.
So every class that is sub-classing this Abstract class gets the advantage of this methods and if there is requirement to read certain more attributes from TFS, then this child class can always Override the methods of abstract class and write their own implementation of reading extra fields like History of that work item or stack rank or any other.
Anil ThakurRank #1,015 · 1.9K reputationPosted Aug 11, 2016, 10:28 AM EDT
Tapan PatelRank #614 · 3.9K reputationPosted Aug 11, 2016, 10:31 AM EDT
Nitin SontakkeRank #264 · 9.6K reputationPosted Aug 11, 2016, 8:11 PM EDT