SlideShare una empresa de Scribd logo
1 de 18
2
    Microsoft .NET Framework Overview




                                               Presented By
                       Arun Kumar Singh & Team
                       Master of Computer Application
                       Microsoft® Certified Professional
                              MCP id- 7802107
www.aumcp2013.jimdo.com arunsingh026@hotmail.com
        All Right Reserved@ AUMCP group of annamalai
        university(Arun Singh)
Garbage Collection(Memory Allocate & Reallocate)
 Garbage Collection in .NET framework

 The Garbage collection is very important technique in the
 .NET framework to free the unused objects in the memory and
 free the space for next incoming process.

 The garbage collection (GC) is new feature in Microsoft .NET
 framework. When we have a class that represents an object in
 the runtime that allocates a memory space in the heap
 memory. All the behavior of that objects can be done in the
 allotted memory in the heap. Once the activities related to that
 object is get finished then it will be there as unused space in
 the memory.
              All Right Reserved@ aumcp group of annamalai
              university(Arun Singh)
The earlier releases of Microsoft products have used a
method like once the process of that object get finished then
it will be cleared from the memory.

Microsoft was planning to introduce a method that should
automate the cleaning of unused memory space in the heap
after the life time of that object. Eventually they have
introduced a new technique "Garbage collection".

 It is very important part in the .NET framework. Now it
handles this object clear in the memory implicitly. It
overcomes the existing explicit unused memory space
clearance.

                  All Right Reserved@ aumcp group of annamalai
                  university(Arun Singh)
Garbage Collection Works?

The heap memory is divided into number of generations.
Normally it is three generations. The Generation 0 is for short
live objects, Generation 1 is for medium live objects which
are moved from Generation 0. Generation 2 is for long live
objects.

When an object is created then it will allocate the memory
space which will be higher. It will be in the Generation 0 and
the memory allocation will be continuous without any space
between the generations of garbage collectors.


                  All Right Reserved@ aumcp group of annamalai
                  university(Arun Singh)
Managed Heap
                                                    Generation 0



Generation 1




                              Generation 2


               All Right Reserved@ aumcp group of annamalai
               university(Arun Singh)
How it’s
Work? Garbage Collection should be handled by the .NET framework.
 Implicit
 When object is created then it will be placed in the Generation 0. The
 garbage collection uses an algorithm which checks the objects in the
 generation, according to there generation CLR decided when it will be
 removed from the memory.

 The two kinds of objects. One is Live Objects and Dead Objects.
 The Garbage collection algorithm collects all unused objects that are dead
 objects in the generation. If the live objects running for long time then
 based on that life time it will be moved to next generation.

 The object cleaning in the generation will not take place exactly after the
 life time over of the particular objects. It takes own time to implement the
 sweeping algorithm to free the spaces to the process.


                      All Right Reserved@ aumcp group of annamalai university(Arun
                      Singh)
When it happens

 The garbage collector periodically checks the heap memory to
 reclaim the objects when the object has no valid references in the
 memory.

 When an object is created then it checks the available space in the
 heap for that object if it is available then it will allocate the memory, if the
 available space is not available to allot the space then it automatically
 garbage collector collect the unused objects. If all object are valid
 referenced then it gets additional space from the processor.




                         All Right Reserved@ aumcp group of annamalai
                         university(Arun Singh)
Example code to know more about Garbage Collection

  MaxGeneration

  This property in the GC class returns the total number of generations.

using System;                                                   The GC is class in which
class GCExample1                                                the MaxGeneartion ,which
{                                                               are count the no of
   public static void Main(string[] args)                       generation
   {
     try
     {
         Console.WriteLine("GC Maximum
Generations:" + GC.MaxGeneration);
     }
     catch (Exception oEx)
     {
         Console.WriteLine("Error:" + oEx.Message);
     }
                            All Right Reserved@ aumcp group of annamalai
   }                        university(Arun Singh)
GetTotalMemory and GetGeneration

using System;
class BaseGC
{
   public void Display()
   {
     Console.WriteLine("Example Method");
   }                                                  GettotalMemory is
}                                                     the method,which
                                                      are gives a total
class GCExample2
{
   public static void Main(string[] args)
   {
     try
     {
         Console.WriteLine("Total Memory:" + GC.GetTotalMemory(false));
         BaseGC oBaseGC = new BaseGC();
         Console.WriteLine("BaseGC Generation is :" + GC.GetGeneration(oBaseGC));
         Console.WriteLine("Total Memory:" + GC.GetTotalMemory(false));
     }                          All Right Reserved@ aumcp group of annamalai
                           university(Arun Singh)
catch (Exception oEx)
     {
       Console.WriteLine("Error:" + oEx.Message);
     }
  }}

Result

 Here GetTotalMemory shows the total number of memory occupied by
 the various resources. Here I have added one more managed code
 objects in the heap memory. After adding, the size of the memory has
 increased.

 The GetGeneration method will find out the particular managed object
 in the which generation. Here it shows the Object oBaseGC in the
 0th generation.

                        All Right Reserved@ aumcp group of annamalai
                        university(Arun Singh)
CollectionCount and Collect
 using System;
 class Cal
 {
    public int Add(int a, int b)
    {
      return (a + b);
    }
    public int Sub(int a, int b)
    {
      return (a - b);
    }
    public int Multi(int a, int b)
    {
      return (a * b);
    }
    public int Divide(int a, int b)
    {
      return (a / b);
    }                         All Right Reserved@ aumcp group of annamalai university(Arun
 }                            Singh)
class GCExample3
{
   public static void Main(string[] args)
   {
     Cal oCalci = new Cal();
     Console.WriteLine("Calci object is now on " + GC.GetGeneration(oCalci) + "
Generation");
     Console.WriteLine("Garbage Collection Occured in 0th
Generation:" +GC.CollectionCount(0));
     Console.WriteLine("Garbage Collection Occured in 1th
Generation:" +GC.CollectionCount(1));
     Console.WriteLine("Garbage Collection Occured in 2th
Generation:" +GC.CollectionCount(2));
     GC.Collect(0);
     Console.WriteLine("Garbage Collection Occured in 0th
Generation:" +GC.CollectionCount(0));
   }
}


                         All Right Reserved@ aumcp group of annamalai university(Arun
                         Singh)
Result

  The CollectionCount helps us to find out the generation
  wise garbage collection occurred. As we know there are
  totally three generations in the garbage collector. Here I
  have passed argument as one for know the first
  generation. Initially it was 0. Then through the code I have
  collected the unused objects in the 0th generation. Again I
  have checked the CollectionCount in the 0thgeneration.
  Now it says 1.

  The Collect method used to collect the unreferenced
  objects in the heap memory. It will clear the object and
  reclaim the memory space.
                   All Right Reserved@ aumcp group of annamalai university(Arun
                   Singh)
Common Type System
(CTS)
As .NET Framework is language independent and support over 56
different programming languages, many programmers will write data types
in their own programming language.

For example, an integer variable in C# is written as int, whereas in Visual
Basic it is written as integer. Therefore in .NET Framework you have single
class called System.Int32 to interpret these variables. Similarly, for the
ArrayList data type .NET Framework has a common type called
System.Collections.ArrayList.

This system is called Common Type System. The types in .NET
Framework are the base on which .NET applications, components, and
controls are built. Common Type System in .NET Framework defines how
data types are going to be declared and managed in runtime.

                   All Right Reserved@ AUMCP group of annamalai
                   university(Arun Singh)
There are two general types of categories in .NET
Framework that Common Type System support.

Value Types . Value types directly a contain data and are user-
defined or built-in. they are placed in a stack or in order in a
structure.

 E.g              int a=8;                  //directly created

Reference Types. Reference types store a reference of the
value’s memory address. They are allocated in a heap
structure.

E.g               as obj=new as();          //object created
       All Right Reserved@ aumcp group of
       annamalai university(Arun Singh)
Tomorrow Conti………………..




16        All Right Reserved@ aumcp group of annamalai   3/22/2013
          university
Q & A Session
More Information Post Your Questions
on
     www.aumcp2013.jimdo.co
     m
     aumcp2013@live.com




         All Right Reserved@ aumcp group of annamalai
         university(Arun Singh)
Thanks to All




All Right Reserved@ aumcp group of annamalai
university(Arun Singh)

Más contenido relacionado

La actualidad más candente

ArnoCandelScalabledatascienceanddeeplearningwithh2o_gotochg
ArnoCandelScalabledatascienceanddeeplearningwithh2o_gotochgArnoCandelScalabledatascienceanddeeplearningwithh2o_gotochg
ArnoCandelScalabledatascienceanddeeplearningwithh2o_gotochg
Sri Ambati
 
STRIP: stream learning of influence probabilities.
STRIP: stream learning of influence probabilities.STRIP: stream learning of influence probabilities.
STRIP: stream learning of influence probabilities.
Albert Bifet
 

La actualidad más candente (8)

ArnoCandelScalabledatascienceanddeeplearningwithh2o_gotochg
ArnoCandelScalabledatascienceanddeeplearningwithh2o_gotochgArnoCandelScalabledatascienceanddeeplearningwithh2o_gotochg
ArnoCandelScalabledatascienceanddeeplearningwithh2o_gotochg
 
Sea Amsterdam 2014 November 19
Sea Amsterdam 2014 November 19Sea Amsterdam 2014 November 19
Sea Amsterdam 2014 November 19
 
Real Time Big Data Management
Real Time Big Data ManagementReal Time Big Data Management
Real Time Big Data Management
 
Property-based Testing and Generators (Lua)
Property-based Testing and Generators (Lua)Property-based Testing and Generators (Lua)
Property-based Testing and Generators (Lua)
 
H2O Open Source Deep Learning, Arno Candel 03-20-14
H2O Open Source Deep Learning, Arno Candel 03-20-14H2O Open Source Deep Learning, Arno Candel 03-20-14
H2O Open Source Deep Learning, Arno Candel 03-20-14
 
Math synonyms
Math synonymsMath synonyms
Math synonyms
 
STRIP: stream learning of influence probabilities.
STRIP: stream learning of influence probabilities.STRIP: stream learning of influence probabilities.
STRIP: stream learning of influence probabilities.
 
Deep Learning in the Wild with Arno Candel
Deep Learning in the Wild with Arno CandelDeep Learning in the Wild with Arno Candel
Deep Learning in the Wild with Arno Candel
 

Similar a Introduction of c# day2

Java Garbage Collection, Monitoring, and Tuning
Java Garbage Collection, Monitoring, and TuningJava Garbage Collection, Monitoring, and Tuning
Java Garbage Collection, Monitoring, and Tuning
Carol McDonald
 

Similar a Introduction of c# day2 (20)

01class_object_references & 02Generation_GC.pptx
01class_object_references & 02Generation_GC.pptx01class_object_references & 02Generation_GC.pptx
01class_object_references & 02Generation_GC.pptx
 
Java Garbage Collection, Monitoring, and Tuning
Java Garbage Collection, Monitoring, and TuningJava Garbage Collection, Monitoring, and Tuning
Java Garbage Collection, Monitoring, and Tuning
 
Garbage Collection in Java.pdf
Garbage Collection in Java.pdfGarbage Collection in Java.pdf
Garbage Collection in Java.pdf
 
Exploring .NET memory management (iSense)
Exploring .NET memory management (iSense)Exploring .NET memory management (iSense)
Exploring .NET memory management (iSense)
 
Gc in android
Gc in androidGc in android
Gc in android
 
Garbage collection
Garbage collectionGarbage collection
Garbage collection
 
Exploring .NET memory management - A trip down memory lane - Copenhagen .NET ...
Exploring .NET memory management - A trip down memory lane - Copenhagen .NET ...Exploring .NET memory management - A trip down memory lane - Copenhagen .NET ...
Exploring .NET memory management - A trip down memory lane - Copenhagen .NET ...
 
More topics on Java
More topics on JavaMore topics on Java
More topics on Java
 
memory
memorymemory
memory
 
Beirut Java User Group JVM presentation
Beirut Java User Group JVM presentationBeirut Java User Group JVM presentation
Beirut Java User Group JVM presentation
 
DotNetFest - Let’s refresh our memory! Memory management in .NET
DotNetFest - Let’s refresh our memory! Memory management in .NETDotNetFest - Let’s refresh our memory! Memory management in .NET
DotNetFest - Let’s refresh our memory! Memory management in .NET
 
Profiler Guided Java Performance Tuning
Profiler Guided Java Performance TuningProfiler Guided Java Performance Tuning
Profiler Guided Java Performance Tuning
 
Best practices in Java
Best practices in JavaBest practices in Java
Best practices in Java
 
Garbage collection
Garbage collectionGarbage collection
Garbage collection
 
Vol 16 No 2 - July-December 2016
Vol 16 No 2 - July-December 2016Vol 16 No 2 - July-December 2016
Vol 16 No 2 - July-December 2016
 
performance optimization: Memory
performance optimization: Memoryperformance optimization: Memory
performance optimization: Memory
 
JetBrains Australia 2019 - Exploring .NET’s memory management – a trip down m...
JetBrains Australia 2019 - Exploring .NET’s memory management – a trip down m...JetBrains Australia 2019 - Exploring .NET’s memory management – a trip down m...
JetBrains Australia 2019 - Exploring .NET’s memory management – a trip down m...
 
Choosing Right Garbage Collector to Increase Efficiency of Java Memory Usage
Choosing Right Garbage Collector to Increase Efficiency of Java Memory UsageChoosing Right Garbage Collector to Increase Efficiency of Java Memory Usage
Choosing Right Garbage Collector to Increase Efficiency of Java Memory Usage
 
ConFoo - Exploring .NET’s memory management – a trip down memory lane
ConFoo - Exploring .NET’s memory management – a trip down memory laneConFoo - Exploring .NET’s memory management – a trip down memory lane
ConFoo - Exploring .NET’s memory management – a trip down memory lane
 
[BGOUG] Java GC - Friend or Foe
[BGOUG] Java GC - Friend or Foe[BGOUG] Java GC - Friend or Foe
[BGOUG] Java GC - Friend or Foe
 

Último

Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 

Último (20)

Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 

Introduction of c# day2

  • 1. 2 Microsoft .NET Framework Overview Presented By Arun Kumar Singh & Team Master of Computer Application Microsoft® Certified Professional MCP id- 7802107 www.aumcp2013.jimdo.com arunsingh026@hotmail.com All Right Reserved@ AUMCP group of annamalai university(Arun Singh)
  • 2. Garbage Collection(Memory Allocate & Reallocate) Garbage Collection in .NET framework The Garbage collection is very important technique in the .NET framework to free the unused objects in the memory and free the space for next incoming process. The garbage collection (GC) is new feature in Microsoft .NET framework. When we have a class that represents an object in the runtime that allocates a memory space in the heap memory. All the behavior of that objects can be done in the allotted memory in the heap. Once the activities related to that object is get finished then it will be there as unused space in the memory. All Right Reserved@ aumcp group of annamalai university(Arun Singh)
  • 3. The earlier releases of Microsoft products have used a method like once the process of that object get finished then it will be cleared from the memory. Microsoft was planning to introduce a method that should automate the cleaning of unused memory space in the heap after the life time of that object. Eventually they have introduced a new technique "Garbage collection".  It is very important part in the .NET framework. Now it handles this object clear in the memory implicitly. It overcomes the existing explicit unused memory space clearance. All Right Reserved@ aumcp group of annamalai university(Arun Singh)
  • 4. Garbage Collection Works? The heap memory is divided into number of generations. Normally it is three generations. The Generation 0 is for short live objects, Generation 1 is for medium live objects which are moved from Generation 0. Generation 2 is for long live objects. When an object is created then it will allocate the memory space which will be higher. It will be in the Generation 0 and the memory allocation will be continuous without any space between the generations of garbage collectors. All Right Reserved@ aumcp group of annamalai university(Arun Singh)
  • 5. Managed Heap Generation 0 Generation 1 Generation 2 All Right Reserved@ aumcp group of annamalai university(Arun Singh)
  • 6. How it’s Work? Garbage Collection should be handled by the .NET framework. Implicit When object is created then it will be placed in the Generation 0. The garbage collection uses an algorithm which checks the objects in the generation, according to there generation CLR decided when it will be removed from the memory. The two kinds of objects. One is Live Objects and Dead Objects. The Garbage collection algorithm collects all unused objects that are dead objects in the generation. If the live objects running for long time then based on that life time it will be moved to next generation. The object cleaning in the generation will not take place exactly after the life time over of the particular objects. It takes own time to implement the sweeping algorithm to free the spaces to the process. All Right Reserved@ aumcp group of annamalai university(Arun Singh)
  • 7. When it happens The garbage collector periodically checks the heap memory to reclaim the objects when the object has no valid references in the memory. When an object is created then it checks the available space in the heap for that object if it is available then it will allocate the memory, if the available space is not available to allot the space then it automatically garbage collector collect the unused objects. If all object are valid referenced then it gets additional space from the processor. All Right Reserved@ aumcp group of annamalai university(Arun Singh)
  • 8. Example code to know more about Garbage Collection MaxGeneration This property in the GC class returns the total number of generations. using System; The GC is class in which class GCExample1 the MaxGeneartion ,which { are count the no of public static void Main(string[] args) generation { try { Console.WriteLine("GC Maximum Generations:" + GC.MaxGeneration); } catch (Exception oEx) { Console.WriteLine("Error:" + oEx.Message); } All Right Reserved@ aumcp group of annamalai } university(Arun Singh)
  • 9. GetTotalMemory and GetGeneration using System; class BaseGC { public void Display() { Console.WriteLine("Example Method"); } GettotalMemory is } the method,which are gives a total class GCExample2 { public static void Main(string[] args) { try { Console.WriteLine("Total Memory:" + GC.GetTotalMemory(false)); BaseGC oBaseGC = new BaseGC(); Console.WriteLine("BaseGC Generation is :" + GC.GetGeneration(oBaseGC)); Console.WriteLine("Total Memory:" + GC.GetTotalMemory(false)); } All Right Reserved@ aumcp group of annamalai university(Arun Singh)
  • 10. catch (Exception oEx) { Console.WriteLine("Error:" + oEx.Message); } }} Result Here GetTotalMemory shows the total number of memory occupied by the various resources. Here I have added one more managed code objects in the heap memory. After adding, the size of the memory has increased. The GetGeneration method will find out the particular managed object in the which generation. Here it shows the Object oBaseGC in the 0th generation. All Right Reserved@ aumcp group of annamalai university(Arun Singh)
  • 11. CollectionCount and Collect using System; class Cal { public int Add(int a, int b) { return (a + b); } public int Sub(int a, int b) { return (a - b); } public int Multi(int a, int b) { return (a * b); } public int Divide(int a, int b) { return (a / b); } All Right Reserved@ aumcp group of annamalai university(Arun } Singh)
  • 12. class GCExample3 { public static void Main(string[] args) { Cal oCalci = new Cal(); Console.WriteLine("Calci object is now on " + GC.GetGeneration(oCalci) + " Generation"); Console.WriteLine("Garbage Collection Occured in 0th Generation:" +GC.CollectionCount(0)); Console.WriteLine("Garbage Collection Occured in 1th Generation:" +GC.CollectionCount(1)); Console.WriteLine("Garbage Collection Occured in 2th Generation:" +GC.CollectionCount(2)); GC.Collect(0); Console.WriteLine("Garbage Collection Occured in 0th Generation:" +GC.CollectionCount(0)); } } All Right Reserved@ aumcp group of annamalai university(Arun Singh)
  • 13. Result The CollectionCount helps us to find out the generation wise garbage collection occurred. As we know there are totally three generations in the garbage collector. Here I have passed argument as one for know the first generation. Initially it was 0. Then through the code I have collected the unused objects in the 0th generation. Again I have checked the CollectionCount in the 0thgeneration. Now it says 1. The Collect method used to collect the unreferenced objects in the heap memory. It will clear the object and reclaim the memory space. All Right Reserved@ aumcp group of annamalai university(Arun Singh)
  • 14. Common Type System (CTS) As .NET Framework is language independent and support over 56 different programming languages, many programmers will write data types in their own programming language. For example, an integer variable in C# is written as int, whereas in Visual Basic it is written as integer. Therefore in .NET Framework you have single class called System.Int32 to interpret these variables. Similarly, for the ArrayList data type .NET Framework has a common type called System.Collections.ArrayList. This system is called Common Type System. The types in .NET Framework are the base on which .NET applications, components, and controls are built. Common Type System in .NET Framework defines how data types are going to be declared and managed in runtime. All Right Reserved@ AUMCP group of annamalai university(Arun Singh)
  • 15. There are two general types of categories in .NET Framework that Common Type System support. Value Types . Value types directly a contain data and are user- defined or built-in. they are placed in a stack or in order in a structure. E.g int a=8; //directly created Reference Types. Reference types store a reference of the value’s memory address. They are allocated in a heap structure. E.g as obj=new as(); //object created All Right Reserved@ aumcp group of annamalai university(Arun Singh)
  • 16. Tomorrow Conti……………….. 16 All Right Reserved@ aumcp group of annamalai 3/22/2013 university
  • 17. Q & A Session More Information Post Your Questions on www.aumcp2013.jimdo.co m aumcp2013@live.com All Right Reserved@ aumcp group of annamalai university(Arun Singh)
  • 18. Thanks to All All Right Reserved@ aumcp group of annamalai university(Arun Singh)