Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

What's the magic of arrays in C# -


int[] = new int[5]; string[] b = new string[1]; 

the types of both a , b inherit abstract system.array, there no real classes in built-in library(it seems there runtime types, can't find type defination class of int[]). can tell me happens while compiling? , why did they(the c# team) make design(i mean why it's not array<t>,instead using abstract class compiler magics)?

trying reason out within .net type system doesn't far. there core support built jit compiler , clr deal creating arrays. statement this:

        var arr = new int[5]; 

generates il:

  il_0001:  ldc.i4.5   il_0002:  newarr     [mscorlib]system.int32 

which jit compiler translate machine code:

00000035  mov         edx,5                 ; arg2 = array size 0000003a  mov         ecx,6f535f06h         ; arg1 = typeof(int) 0000003f  call        ffd52128              ; call jit_newarr1(type, size) 

core ingredients here dedicated il opcode, newarr, instead of usual newobj opcode creates instance of class. , simple translation clr helper function gets object created. can have look-see @ helper function sscli20 source code, clr\src\vm\jithelpers.cpp. large post here, heavily optimized make kind of code run fast possible, having direct access type internals available clr code.

there 2 of these helpers available, jit_newarr1() creates one-dimensional (vector) arrays , jit_newmdarr() creates multi-dimensional arrays. compare 2 overloads available type.makearraytype().


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -