Get TypeCode for Value Type Int16 in C#

AmitDiwan
Updated on 11-Dec-2019 10:25:09

143 Views

To get the TypeCode for value type Int16, the code is as follows −Example Live Demousing System; public class Demo {    public static void Main() {       short val1 = 0;       short val2 = Int16.MaxValue;       Console.WriteLine("Value1 = "+val1);       Console.WriteLine("Value2 = "+val2);       Console.WriteLine("HashCode for value1 = "+val1.GetHashCode());       Console.WriteLine("HashCode for value2 = "+val2.GetHashCode());       Console.WriteLine("Are they equal? = "+(val1.Equals(val2)));       TypeCode type1 = val1.GetTypeCode();       TypeCode type2 = val2.GetTypeCode();       Console.WriteLine("TypeCode for val1 = "+type1);     ... Read More

Get the Members of the Current Type in C#

AmitDiwan
Updated on 11-Dec-2019 10:21:31

126 Views

To get the members of the current Type, the code is as follows −Example Live Demousing System; using System.Reflection; public class Demo {    public static void Main() {       Type type = typeof(Subject);       try {          FieldInfo fieldInfo = type.GetField("SubName");          MemberInfo[] info = type.GetMembers();          Console.Write("Members = ");          for (int i = 0; i < info.Length; i++)             Console.WriteLine(" {0}", info[i]);          Console.WriteLine("FieldInfo = {0}", fieldInfo);       }       ... Read More

Difference between SAP ECC System and SAP BW System

Lakshmi Srinivas
Updated on 11-Dec-2019 10:17:38

4K+ Views

SAP ECC stands for SAP ERP Central Component (ECC). It is a standout amongst the most perceived resources that SAP has developed. It is an ERP software which comprises in a few modules that give the association’s awesome control over their key business forms.Various modules can speak with each other to make a completely coordinated application particular to any client inside an extensive variety of industry areas. It can be customized to serve the individual needs as well.SAP ECC executions are a major test for any client due to the hazard that speaks to changing the way they oversee fundamental ... Read More

Count Key-Value Pairs in Hashtable in C#

AmitDiwan
Updated on 11-Dec-2019 10:17:20

368 Views

To count the number of key/value pairs in the Hashtable, the code is as follows −Example Live Demousing System; using System.Collections; public class Demo {    public static void Main() {       Hashtable hash = new Hashtable();       hash.Add("A", "SUV");       hash.Add("B", "MUV");       hash.Add("C", "AUV");       Console.WriteLine("Hashtable elements...");       foreach(DictionaryEntry d in hash) {          Console.WriteLine(d.Key + " " + d.Value);       }       Console.WriteLine("Count of Key/value pairs = "+hash.Count);       hash.Add("D", "Utility Vehicle");       hash.Add("E", "Convertible"); ... Read More

Insert Object at the Top of Stack in C#

AmitDiwan
Updated on 11-Dec-2019 10:12:29

284 Views

To insert an object at the top of the Stack, the code is as follows −Example Live Demousing System; using System.Collections.Generic; public class Demo {    public static void Main() {       Stack stack = new Stack();       stack.Push(100);       stack.Push(150);       stack.Push(175);       stack.Push(200);       stack.Push(225);       stack.Push(250);       Console.WriteLine("Elements in the Stack:");       foreach(var val in stack) {          Console.WriteLine(val);       }       Console.WriteLine("Count of elements in the Stack = "+stack.Count);       ... Read More

Insert Element into ArrayList at Specified Index in C#

AmitDiwan
Updated on 11-Dec-2019 10:08:05

335 Views

To insert an element into the ArrayList at the specified index, the code is as follows −Example Live Demousing System; using System.Collections; public class Demo {    public static void Main() {       ArrayList list = new ArrayList();       list.Add("One");       list.Add("Two");       list.Add("Three");       list.Add("Four");       list.Add("Five");       list.Add("Six");       list.Add("Seven");       list.Add("Eight");         Console.WriteLine("ArrayList elements...");       foreach(string str in list) {          Console.WriteLine(str);       }       Console.WriteLine("ArrayList is read-only? ... Read More

Get TypeCode for Value Type UInt32 in C#

AmitDiwan
Updated on 11-Dec-2019 10:04:29

142 Views

To get the TypeCode for value type UInt32, the code is as follows −Example Live Demousing System; public class Demo {    public static void Main() {       uint val1 = 55;       uint val2 = 100;       TypeCode type1 = val1.GetTypeCode();       TypeCode type2 = val2.GetTypeCode();       Console.WriteLine("Typecode for val1 = "+type1);       Console.WriteLine("Typecode for val2 = "+type2);    } }OutputThis will produce the following output −Typecode for val1 = UInt32 Typecode for val2 = UInt32ExampleLet us see another example − Live Demousing System; public class Demo {   ... Read More

Get All Interfaces Implemented or Inherited by Current Type in C#

AmitDiwan
Updated on 11-Dec-2019 10:01:43

565 Views

To get all the interfaces implemented or inherited by the current Type, the code is as follows −Example Live Demousing System; public class Demo {    public static void Main() {       Type type = typeof(float);       Type myInterface = type.GetInterface("IFormattable", true);       Type[] myInterfaces = type.GetInterfaces();       Console.WriteLine("Interface = "+myInterface);       Console.WriteLine("All the Interfaces...");       for (int i = 0; i < myInterfaces.Length; i++)       Console.WriteLine(""+myInterfaces[i]);    } }OutputThis will produce the following output −Interface = System.IFormattable All the Interfaces... System.IComparable System.IFormattable System.IConvertible System.IComparable`1[System.Single] System.IEquatable`1[System.Single]Let us see another example −Example Live ... Read More

Get Specific Interface Implemented or Inherited by Current Type in C#

AmitDiwan
Updated on 11-Dec-2019 09:59:31

143 Views

To get a specific interface implemented or inherited by the current Type, the code is as follows −Example Live Demousing System; public class Demo {    public static void Main() {       Type type = typeof(double);       Type myInterface = type.GetInterface("IFormattable");       Console.WriteLine("Interface = "+myInterface);    } }OutputThis will produce the following output −Interface = System.IFormattableExampleLet us see another example − Live Demousing System; public class Demo {    public static void Main() {       Type type = typeof(float);       Type myInterface = type.GetInterface("IFormattable",true);       Console.WriteLine("Interface = "+myInterface);    } }OutputThis will produce the following output −Interface = System.IFormattable

Common Practices for Modifying Python Modules

Rajendra Dharmkar
Updated on 11-Dec-2019 09:59:06

362 Views

If you are modifying a module and want to test it in the interpreter without having to restart the shell everytime you save that module, you can use the reload(moduleName) function. reload(moduleName) reloads a previously loaded module (assuming you loaded it with the syntax "import moduleName". It is intended for conversational use, where you have edited the source file for a module and want to test it without leaving Python and starting it again.For example>>> import mymodule >>> # Edited mymodule and want to reload it in this script >>> reload(mymodule)Note that the moduleName is the actual name of the ... Read More

Advertisements