.NET FAQs Unleashed!
Skip Navigation Links
Interview questions on Design Patterns in .NET
ASP.NET Ajax Interview Questions
Interview questions related to security
C# Interview Questions
ASP.NET Interview Questions
Interview Questions in ASP.NET 2.0
Articles at dotnetuncle.com
Skip Navigation Links
OOPs questions in .NET
Questions on .NET Framework
ADO.NET Interview Questions
Short Answer questions in .NET
Frequently asked differences in .NET
Important commonly used Acronyms in .NET
MS SQL, Oracle SQL Interview Questions
 
    
Dotnetuncle's Tip:

  The outermost element of a .NET program is the namespace, a technique used to group similar classes under the same umbrella and signify the hierarchy of classes.

    

How to inherit the class, but not the method inside it in C#? What is a sealed method in C#? Can a method in C# be sealed? How to create a sealed method in C#?

If a method is not to be inherited, but the class is, then the method is sealed. It becomes a sealed method of a class. It is important to note here that in C#, a method may not be implicitly declared as sealed. This means that a method cannot be sealed directly. A method in C# can be sealed only when the method is an overriden method. Once the overriden method is declared as sealed, it will not be further overriding of this method. See code sample below, where an overriden method is sealed.

C# Example
class SomeClass
{
   public int a;
   public int b;

  public virtual void SomeMethod()
  {
    Console.WriteLine("This is a virtual method");
  }
}
class SomeClass : DerivedClass
{
   public override sealed void SomeMethod()
   {
     Console.WriteLine("This is a sealed method");
   }
}

To know what is a sealed class in C#Click Here

Protected Internal  Array  Sort Array  Throw  Multiple Catch  Polymorphism  Inheritance  Session Viewstate  Autogenerate  ReadOnly  Sealed Class  Sealed Method  Multiple Interfaces  Overloading  Overloaded Constructors  Generics  Main  Case Sensitive  Console  Specifier  Return Type  SetCommandLineArgs  System Environment  New  Default Values of Types Compiler Error Constant Variable Const Const - ReadOnly Parameter Modifier Out Ref Interface Interface Reference, is, as System.Collection

More Interview Questions...
Skip Navigation Links
Interview questions on Design Patterns in .NET
ASP.NET Ajax Interview Questions
Interview questions related to security
C# Interview Questions
ASP.NET Interview Questions
Interview Questions in ASP.NET 2.0
Articles at dotnetuncle.com
Skip Navigation Links
OOPs questions in .NET
Questions on .NET Framework
ADO.NET Interview Questions
Short Answer questions in .NET
Frequently asked differences in .NET
Important commonly used Acronyms in .NET
MS SQL, Oracle SQL Interview Questions



    
Dotnetuncle's Tip:

  A keyword 'delegate' is used to create a delegate. The caller calls this delegate, and in turn, the delegate invokes the target method. To do this, a method is assigned to the delegate variable.