views:

44

answers:

1

Last day I have been interviewed and the interviewer asked me

a) what is dotnet Modules?

b) What is the new dynamic keyword and what is it's use(dot net 4.0)

c) what is the difference between dynamic keyword and var(dotnet 3.5+)

d) What is the difference between Var & Object? Why should we use one over another?

Could anyone be kind enough in answering this.

Thanks.

+1  A: 

From Module Statement

Modules are a reference type similar to classes, but with some important distinctions. The members of a module are implicitly Shared and scoped to the declaration space of the standard module's containing namespace, rather than just to the module itself. Unlike classes, modules can never be instantiated, do not support inheritance, and cannot implement interfaces. A module can only be declared in a namespace and cannot be nested in another type.

From dynamic (C# Reference)

The dynamic type enables the operations in which it occurs to bypass compile-time type checking. Instead, these operations are resolved at run time. The type simplifies access to COM APIs such as the Office Automation APIs, and also to dynamic APIs such as IronPython libraries, and to the HTML Document Object Model (DOM).

And [c#] dynamic vs var

astander
Hi Astender, Thanks fo rthe asnwer. But what is the real benefit of modules? How can we use it and in what scenario?.Thanks in adv
priyanka.bangalore
This should explain it a little better http://www.homeandlearn.co.uk/net/nets9p7.html
astander
Is it a vb.net feature and not C#?
priyanka.bangalore
Yes, MODULES are VB.NET
astander