转载: .net程序员偏向组件开发的面试题
2010-01-02 05:50
225 查看
转载自:http://www.mwilliams.info/archive/2005/07/net-interview-questions-2-answers.php
C# Component Developers
Juxtapose the use of override with new. What is shadowing?
--- Override redefines an inherited method which was marked as virtual or abstract, and its access level must be the same as the method it overrides. New allows you to completely hide an inherited member and create a different implementation of it with whatever attributes you choose. Shadowing is another name for disabling an inherited method and redefining it.
Explain the use of virtual, sealed, override, and abstract.
--- Virtual marks a method as overridable. Sealed marks a class as uninheritable. Override redefines a method declared as virtual. Abstract defines a class which cannot be instantiated, or a method which must be overriden in any derived classes.
Explain the importance and use of each component of this string: Foo.Bar, Version=2.0.205.0, Culture=neutral, PublicKeyToken=593777ae2d274679d
--- Assembly name -- used for loading. Assembly version -- also used for loading. Culture -- defines culture settings used for string translation and other locale-specific settings. PublicKeyToken -- used to uniquely identify this assembly and prevent collisions.
Explain the differences between public, protected, private and internal.
--- Public: accessible from any class. Private: accessible only from within the same class. Protected: like private, but derived classes may also access. Internal: like public, but accessible only by code within the same assembly.
What benefit do you get from using a Primary Interop Assembly (PIA)?
--- A PIA is a strongly-named assembly which defines COM interfaces for a component. Because it is strongly-named, it can be loaded into the GAC and verified against the COM component's own signature to give the component collision-protection and authorship-verification benefits when interacing with .NET code.
By what mechanism does NUnit know what methods to test?
--- Reading attributes defined for classes and methods via reflection.
What is the difference between: catch(Exception e){throw e;} and catch(Exception e){throw;}
--- Both statements will catch and throw exception, but the latter will preserve the original exception stack.
---
What is the difference between typeof(foo) and myFoo.GetType()?
--- The first returns the object's type at compile time; the second returns it at runtime.
---
Explain what’s happening in the first constructor: public class c{ public c(string a) : this() {;}; public c() {;} } How is this construct useful?
--- The first constructor invokes the base constructor in addition to its own functionality; this would be useful if your base initialized basic field values or had other code that all other constructors would utilize.
What is this? Can this be used within a static method?
--- The "this" reference refers to the current object context. Static methods have no context, so it is not valid.
C# Component Developers
Juxtapose the use of override with new. What is shadowing?
--- Override redefines an inherited method which was marked as virtual or abstract, and its access level must be the same as the method it overrides. New allows you to completely hide an inherited member and create a different implementation of it with whatever attributes you choose. Shadowing is another name for disabling an inherited method and redefining it.
Explain the use of virtual, sealed, override, and abstract.
--- Virtual marks a method as overridable. Sealed marks a class as uninheritable. Override redefines a method declared as virtual. Abstract defines a class which cannot be instantiated, or a method which must be overriden in any derived classes.
Explain the importance and use of each component of this string: Foo.Bar, Version=2.0.205.0, Culture=neutral, PublicKeyToken=593777ae2d274679d
--- Assembly name -- used for loading. Assembly version -- also used for loading. Culture -- defines culture settings used for string translation and other locale-specific settings. PublicKeyToken -- used to uniquely identify this assembly and prevent collisions.
Explain the differences between public, protected, private and internal.
--- Public: accessible from any class. Private: accessible only from within the same class. Protected: like private, but derived classes may also access. Internal: like public, but accessible only by code within the same assembly.
What benefit do you get from using a Primary Interop Assembly (PIA)?
--- A PIA is a strongly-named assembly which defines COM interfaces for a component. Because it is strongly-named, it can be loaded into the GAC and verified against the COM component's own signature to give the component collision-protection and authorship-verification benefits when interacing with .NET code.
By what mechanism does NUnit know what methods to test?
--- Reading attributes defined for classes and methods via reflection.
What is the difference between: catch(Exception e){throw e;} and catch(Exception e){throw;}
--- Both statements will catch and throw exception, but the latter will preserve the original exception stack.
---
What is the difference between typeof(foo) and myFoo.GetType()?
--- The first returns the object's type at compile time; the second returns it at runtime.
---
Explain what’s happening in the first constructor: public class c{ public c(string a) : this() {;}; public c() {;} } How is this construct useful?
--- The first constructor invokes the base constructor in addition to its own functionality; this would be useful if your base initialized basic field values or had other code that all other constructors would utilize.
What is this? Can this be used within a static method?
--- The "this" reference refers to the current object context. Static methods have no context, so it is not valid.
相关文章推荐
- 转载: .net程序员偏向XML开发的面试题
- 转载: .net程序员偏向ASP.NET的面试题
- SSIS数据流组件开发(1)转载
- 【转载】Flex 调用外部JS(中级篇) - Uyang - Photoshop Flash Flex Apollo 教程 组件 开发 源代码
- (转载)FLEX 界面SKIN样式设计 - Uyang - Photoshop Flash Flex Apollo 教程 组件 开发 源代码
- .NET面试题 – 组件开发人员 & XML开发人员
- 应聘.net开发工程师常见的面试题(一)(转载)
- NET面试题 – 组件开发人员 & XML开发人员
- iOS面试题大全APP 开发Review - 第三方组件
- 【转载】Asp.NET大文件上传组件开发总结(二)---提取文件内容
- 微信小程序开发—快速掌握组件及API的方法---转载
- 一个帖子学会Android开发四大组件(转载)
- 向Web开发人员推荐12款优秀的 Twitter Bootstrap 组件和工具(转载)
- 【转载】Asp.NET大文件上传组件开发总结(三)---处理文件内容
- 【转载】[.net程序员面试题]
- .NET面试题 – 组件开发人员 & XML开发人员
- 在.net应用程序中使用用户控件-.NET教程,组件控件开发(转载)
- 【转载】Asp.NET大文件上传组件开发总结(四)---封送数据给Asp.NET页面
- javascript组件开发方式(转载)
- 【转载】Asp.NET大文件上传组件开发总结(五)---上传进度信息的显示