It's easy to be a long-term investor in a bull market, since rising stock prices attract more buyers and seem to constantly propel stock prices skyward. But when the growling bear bites, many of those "long-term" investors rush for the exits and quickly abandon their dreams of multi-decade gains.

It can be challenging to stick with your favorite stocks forever, or at least until you retire, because those occasional drawdowns can be very painful. However, investors who pick the right evergreen stocks and stick with them for decades instead of years will frequently reap triple-digit returns.

So today, I'll take a closer look at a trio of resilient stocks that investors can buy and comfortably hold "forever" -- Costco (COST -0.12%), Microsoft (MSFT -2.45%), and General Mills (GIS -0.32%).

An investor studies a financial report in front of two trading screens.

Image source: Getty Images.

1. Costco

Costco, which operates 830 warehouses worldwide, is an evergreen investment for three reasons. First, it consistently sells its products, often in bulk, at lower prices than other retailers because it actually generates most of its profits from its high-margin membership fees. Its discount strategy makes it an attractive shopping destination during economic downturns.

Second, its annual memberships are sticky. Just as with Amazon Prime, Costco's customers often feel compelled to regularly shop at its warehouses because they're already paying annual fees. Lastly, the company still has plenty of room to expand overseas; more than 80% of its warehouses are still located in the U.S. (including Puerto Rico) and Canada.

Between fiscal 2011 and 2021, which ended last August, Costco's annual revenue rose from $87.1 billion to $192.1 billion, representing a compound annual growth rate (CAGR) of 8.2%. Its earnings per share (EPS) grew at a CAGR of 13.1%. After factoring in reinvested dividends, its stock generated an impressive total return of 580% over the past 10 years.

Past performance never guarantees future gains, but Costco's business model should remain resilient through future recessions -- even if inflation and other macro headwinds squeeze its near-term margins.

2. Microsoft

Microsoft is one of the most diversified tech companies in the world. It's the creator of Windows, the world's most popular operating system for PCs, and its broad portfolio of enterprise and productivity software includes Office, Dynamics, and Teams. It owns Azure, the world's second-largest cloud infrastructure platform after Amazon Web Services (AWS), and it also sells Xbox gaming consoles and Surface devices.

Under Satya Nadella, who took over as Microsoft's third CEO in 2014, the company transformed a lot of its desktop and server software into cloud-based services. As a result, its commercial cloud revenue rose from 5% of its top line in fiscal 2014 to 41% in fiscal 2021, which ended last June. During those seven years, its annual revenue grew at a CAGR of 10% as its EPS increased at a CAGR of 17%.

Over the past decade, Microsoft's stock delivered a total return of nearly 950%. That explosive rally, which lifted its market cap to nearly $2 trillion, silenced the critics who claimed its high-growth days were over.

Microsoft's stock isn't immune to macroeconomic headwinds like a stronger dollar, supply chain disruptions, or slower enterprise spending. But if you're looking for a well-run tech giant that's likely to generate consistent growth over the next few decades, Microsoft fits the bill.

3. General Mills

General Mills sells Cheerios, Häagen-Dazs, Yoplait, and more than a hundred other well-known packaged food brands. It also added premium pet food to its portfolio with its takeover of Blue Buffalo in 2018.

General Mills might seem like a wobbly investment because it expects inflation to dent its near-term margins. It also faces a lot of competition from private label, local, and organic brands.

Yet General Mills has ridden out plenty of inflation cycles and recessions throughout its 94-year history as a public company. It's also consistently ranked as one of the top 10 multinational food companies that control most of the world's packaged food brands.

Between fiscal 2011 and 2021, which ended last May, its revenue rose from $14.9 billion to $18.1 billion, or a CAGR of 2%. Its EPS grew a CAGR of 3.4%. Those growth rates might seem anemic, but General Mills still generated a total return of 150% over the past 10 years because it remains a favorite defensive stock during uncertain times. Even after those steady long-term gains, its stock still trades at just 17 times forward earnings and pays a forward dividend yield of nearly 3%.

General Mills isn't an ideal stock for growth-oriented investors, but it's a reliable anchor for a well-diversified portfolio. Rising interest rates over the next few quarters will reveal just how important big and boring anchors like General Mills can be.