It's a loaded question with too many variables to have an answer.
How much do you weigh?
How many miles do you put on in a year?
How many jumps or drops do you do?
How many Rock Gardens do you ride?
I have a friend that mountain bikes over 5,000 miles per year. He doesn't do jumps or drops but rides rock gardens frequently. It took him 6 years to kill a Specialized aluminum hardtail bike.
It's like asking how long will the brakes last on my car. Guarantee the mail man is replacing brake pads and rotors on his car a few times year in less mileage than most of us put on in a few years before they need to be changed.