top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What are restrictions of new modifier?

+1 vote
304 views
What are restrictions of new modifier?
posted Apr 24, 2017 by Madhavi Kumari

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes
  1. A member declaration with a new modifier hides an inherited member only within the scope of the new member.

  2. A member declaration with a new modifier cannot include override keyword in its declaration. It is an error to include both new and Override modifiers in the same declaration

answer Aug 10, 2017 by Manikandan J
Similar Questions
+1 vote

If write this code in form 1 :

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Xml.Serialization;

namespace PostLab5_**********
{
    public partial class Form1 : Form
    {
        List<StudentInfo> Stu_Info = new List<StudentInfo>();
        Queue<StudentInfo> pass = new Queue<StudentInfo>();
        Queue<StudentInfo> fail = new Queue<StudentInfo>();
        Stack<StudentInfo> Excelent = new Stack<StudentInfo>();
        Stack<StudentInfo> VeryGood = new Stack<StudentInfo>();
        Stack<StudentInfo> Good = new Stack<StudentInfo>();
        public Form1()
        {
            InitializeComponent();
        }

        private void importXMLToolStripMenuItem_Click(object sender, EventArgs e)
        {

            OpenFileDialog Dlg = new OpenFileDialog();
            Dlg.Filter = "XML File|*.xml";
            if (Dlg.ShowDialog() == DialogResult.OK)
            {
                StreamReader Infile = new StreamReader(Dlg.FileName);
                XmlSerializer Des = new XmlSerializer(typeof(List<StudentInfo>));
                Stu_Info = (List<StudentInfo>)Des.Deserialize(Infile);
                Infile.Close();
                dataGridView1.DataSource = Stu_Info;
            }
        }

        private void passedToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var R = from Item in Stu_Info
                    where Item.total >= 50
                    select Item;
            dataGridView1.DataSource = R.ToArray();
            foreach (StudentInfo item in R)
            {
                pass.Enqueue(item);
            }
        }

        private void failedToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var R = from Item in Stu_Info
                    where Item.total < 50
                    select Item;
            dataGridView1.DataSource = R.ToArray();
            foreach (StudentInfo item in R)
            {
                fail.Enqueue(item);
            }
        }

        private void excellentToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var R = from Item in Stu_Info
                    where Item.total >= 84
                    select Item;
            dataGridView1.DataSource = R.ToArray();
            foreach (StudentInfo Item in R)
            {
                Excelent.Push(Item);
            }
        }

        private void veryGoodToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var R = from Item in Stu_Info
                        where Item.total >=76 && Item.total <84
                        select Item;
                dataGridView1.DataSource = R.ToArray();
                foreach (StudentInfo Item in R)
                {
                    VeryGood.Push(Item);
                }
            }

        private void goodToolStripMenuItem_Click(object sender, EventArgs e)
        {
             var R = from Item in Stu_Info
                        where Item.total >= 68 && Item.total < 76
                        select Item;
                dataGridView1.DataSource = R.ToArray();
                foreach (StudentInfo Item in R)
                {
                    Good.Push(Item);
                }
        }

        private void countOfVeryGoodToolStripMenuItem_Click(object sender, EventArgs e)
        {
            MessageBox.Show(VeryGood.Count().ToString());
        }

        private void peekOfPeekToolStripMenuItem_Click(object sender, EventArgs e)
        {
            MessageBox.Show(Good.Peek().name);
        }

        private void removeItemFromFailedToolStripMenuItem_Click(object sender, EventArgs e)
        {
            MessageBox.Show(fail.Dequeue().name);
        }

        private void countOfPassedToolStripMenuItem_Click(object sender, EventArgs e)
        {
            MessageBox.Show(pass.Count().ToString());
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Form2 f2 = new Form2();

        }
        }
    }

and in form2 contain textboxes to add new item for these list ! how use this !

...