Category: .Net

Debug and Trace discussion

Debug is used during debugging. Trace is writing to the log file. It is kind of like logging. Both are very similar, but do tracing for long term retention, debugging for real time debugging. When we monitor application execution and performance in development stage is termed as “Debugging” and when you do in deployed environment it’s termed as ‘Tracing’. Debug… Read more →

Reflection in .Net

The classes in the System. Reflection namespace, together with System.Type, enable to obtain information about loaded assemblies and the types defined within them, such as classes, interfaces, and value types. We can also use reflection to create type instances at run time, and to invoke and access them. For topics about specific aspects of reflection. Assemblies contain modules, modules contain… Read more →

Difference between Convert,Explicit type,Tryparse and Parse c#

(int)Something; int.Parse(Something); Convert.ToInt32(Something); 1) that is a cast 2) Parsing taking in a string and attempts to convert it to a type. —when string is null refence,it will throw ArgumentNullException.if string is other than integer value ,it will throw FormatException.if reperesents a number less than Min or maxvalue than will throw overflowexception. string s1 = “1234”; string s2 = “1234.65”;… Read more →

Boxing and Unboxing

Boxing is used to store value types in the garbage-collected heap. Boxing is an implicit conversion of a value type to the type object or to any interface type implemented by this value type. Boxing a value type allocates an object instance on the heap and copies the value into the new object Boxing Conversion explicit boxing is never required:… Read more →

Use as and is Operators for casting

The as operator is more efficient because it actually returns the cast value if the cast can be made successfully. The is operator returns only a Boolean value. It can therefore be used when we just want to determine an object’s type but do not have to actually cast it. Use the is operator to verify the type before performing a… Read more →

Visual C# Code Snippets

Link     By default the following code snippets are included in Visual Studio. Name (or shortcut) Description Valid locations to insert snippet #if Creates a #if directive and a #endif directive. Anywhere. #region Creates a #region directive and a #endregion directive. Anywhere. ~ Creates a destructor for the containing class. Inside a class. attribute Creates a declaration for a class that derives from Attribute. Inside a namespace (including… Read more →

Value Types and Reference Types Comparison

Intriguing Question Value Type Reference Type How is a variable represented? Value type variables are local copies. Reference type variables are pointing to the memory occupied by the allocated instance. What is the base type? Implicitly extends System.ValueType. Can derive from any other type (except System. ValueType), as long as that type is not “sealed” (more details on this in… Read more →

Mvc Scenario based discussion

MVC– 1)definition: it is framework that splits an application’s implementation logic into three component roles: –Model->work as business logic and storage mechanism to store the data. Entity framework work in this component. view ->it is user interface logic to which user direct interact in this component. Asp. Net and Razor use in view component. controller->it is handle the request from… Read more →