An app can control the version of the .NET Framework on which it runs, but a component cannot. Components and class libraries are loaded in the context of a particular app, and therefore automatically run on the version of the .NET Framework that the app runs on.

In CLR 4

  • If a project contains reference of higher CLR (.NET 3.5(console app) referencing .NET 4.0(assembly)), then project won’t compile.
  • If a project contains the reference of lower CLR (.NET 4.0(console app) referencing .NET 3.5(assembly)), then the project will compile.
  • The Same concept is applied for .NET versions. The Higher version can always reference, assemblies of lower version but not vice versa.

But is it different In CLR 2

  • If a project contains a reference of higher CLR (.NET 2.0(console app) referencing .NET 3.5(assembly)), then the project will compile.
  • If a project contains a reference of lower CLR (.NET 3.5(console app) referencing .NET 2.0(assembly)), then the project will compile.
  • The Same concept is applied for .NET versions. The Higher version can always reference, assemblies of lower version and vice versa.

 

Share Button

Often, String objects are used to contain sensitive data such as a user’s password or creditcard information. Unfortunately, String objects contain an array of characters in memory, and if some unsafe or unmanaged code is allowed to execute, the unsafe/unmanaged code could snoop around the process’s address space, locate the string containing the sensitive information, and use this data in an unauthorized way. Even if the String object is used for just a short time and then garbage collected, the CLR might not immediately reuse the String object’s memory (especially if the String object was in an older generation), leaving the String’s characters in the process’s memory, where the information could be compromised. In addition, since strings are immutable, as you manipulate them, the old copies linger in memory and you end up with different versions of the string scattered all over memory.
Read More →

Share Button