An abstract class is one that is intended only to be a base class of other classes, and the “abstract” modifier is used to make a class abstract. An abstract class cannot be a sealed class. An abstract method cannot be private. The access modifier of the abstract method should be same in both the abstract class and its derived class. An abstract method cannot have the modifier virtual. Because an abstract method is implicitly virtual.
An abstract class can have abstract members as well non abstract members.
It can have constants, read only variables, instance variables and static variables.
We cannot create an object of abstract class.
Abstract class contains Constructors.
Only Complete Member of abstract class can be Static.
A class can inherit only one abstract class.
A class inheriting an abstract class has to override the abstract methods from abstract class while implementing them.
We go for Abstract classes on such situations, When we have a requirement where our base class should provide default implementation of certain methods whereas other methods should be open to being overridden by child classes use abstract classes.
An interface is an entity that is defined by the word Interface, it is not a class. An interface contains only the signatures of methods. Interface members cannot have any access specifier like public, private, protected, internal or protected internal. By default all the members of an interface are Public.
In an interface all the members are implicitly abstract.
It cannot have member variables.
We can create an object of interface by type casting it to class name.
Interface doesn’t contains Constructors.
Member of interface can not be Static.
A class can implement any number of Interfaces.
A class implementing an interface has to implement all the methods of the interface compulsorily.
We go for Abstract classes on such situations, If our child classes should all implement a certain group of methods but each of the child classes is free to provide its own implementation then use interfaces.
These are the basic differences between abstract class and interface.
Sometimes we need to check the application instance running status.
var isExists = System.Diagnostics.Process.GetProcessesByName(System.IO.Path.GetFileNameWithoutExtension(System.Reflection.Assembly.GetEntryAssembly().Location)).Count() > 1;
If you want to kill the currently loading process instantly application process, you can use below code.
if (System.Diagnostics.Process.GetProcessesByName(System.IO.Path.GetFileNameWithoutExtension(System.Reflection.Assembly.GetEntryAssembly().Location)).Count() > 1) System.Diagnostics.Process.GetCurrentProcess().Kill();
You need to add a reference to System.Core.dll for the .Count() extension method. Alternatively, you can use the .Length property.
“Unable to generate a temporary class (result=1)” is returned when .Net integration tries to parse the Enterprise WSDL version 32.0
In Winter ’15 (API version 32.0), a number of additional sObjects are available including ListViewRecord, whose definition is as follows:
Media Access Control (MAC) address is a unique identifier assigned to most network adapters or network interface cards (NICs) by the manufacturer for identification and used in the Media Access Control protocol sub-layer. If assigned by the manufacturer, a MAC address usually encodes the manufacturer’s registered identification number. It also be known as an Ethernet Hardware Address (EHA).
In this article, I will demonstrate how to get system MAC address using C#.
public string GetMACAddress()
var macAddress = string.Empty;
NetworkInterface onjNI = NetworkInterface.GetAllNetworkInterfaces();
foreach (NetworkInterface adapter in onjNI)
IPInterfaceProperties objIP = adapter.GetIPProperties();
macAddress = adapter.GetPhysicalAddress().ToString();