hi
write a programming some peoples called a hard coding. what is hard code and which type of code is called as Hard Code.
Thanks.
What is a Hard Code?
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
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
Jaish MathewsRank #225 · 11K reputationPosted Apr 11, 2010, 10:58 PM EDT
Here simple example.
Scenario - Need to access System Path
//Hardcoding
string filePath = "C:\WINDOWS\system32"
MessageBox.Show(s);
Problem-System folder will be changed based on OS and Machine.
//Dynamic coding
string filePath = Environment.GetFolderPath(Environment.SpecialFolder.System)
Advantage-Regardless of OS and Machine, correct value will be returned