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.

c# - var in class gives error -


possible duplicate:
using var outside of method

class { string x; } // proper class { var x; } // improper (gives error) 

why it, cant have var type variable declare in class , can done in order achieve or alternative ?

in function/method, can declare var type variable,then why can't, in class ?

thanks.

// method variable var x; 

is never valid - inside method; need immediate initialization infer type:

// method variable var x = "abc"; // string 

as why isn't available fields field-initializer: simply, spec says so. why spec says debate... check annotated spec, suspicion more necessary method variables, logic more complex (re linq etc). also, often used anonymous types (that being necessity existence); anonymous types can't exposed on public api... have confusing:

private var foo = new { x = 123, y = "abc"}; // valid public var bar = new { x = 123, y = "abc"}; // invalid 

so in i'm happy current logic.


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 -