menuitems.addrange in .Net 5

MRUTYUNJAYA MAHAPATRA 1 Reputation point
2021-04-09T08:35:44.603+00:00

Hi, I am migrating our project to .Net 5.

As per documentation menuitem is deprecated in .Net5 and ToolStripMenuItem is used instead, which replaces the MenuItem control.

I was using Addrange function of menuitem . Can anybody please suggest that what is the corresponding of Addrange in ToolStripMenuItem. How can I migrate this ?

following are code snippets below ....

private System.Windows.Forms.MenuStrip MainMenu;
private System.Windows.Forms.ToolStripMenuItem mnuFile;

this.MainMenu.Items.AddRange(new System.Windows.Forms.ToolStripMenuItem[] { this.mnuFile});
//
// mnuFile
//
this.mnuFile.MergeIndex = 0;
this.mnuFile.MenuItems.AddRange(new System.Windows.Forms.ToolStripMenuItem[] {

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,828 questions
Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,671 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,245 questions
.NET Runtime
.NET Runtime
.NET: Microsoft Technologies based on the .NET software framework.Runtime: An environment required to run apps that aren't compiled to machine language.
1,119 questions
Windows Network
Windows Network
Windows: A family of Microsoft operating systems that run across personal computers, tablets, laptops, phones, internet of things devices, self-contained mixed reality headsets, large collaboration screens, and other devices.Network: A group of devices that communicate either wirelessly or via a physical connection.
648 questions
{count} votes