第 56 题
7 ?7 w8 T) d+ {你正在为一个客户开发一个财务报表。你的客户在美国有总部,在密西哥有分部。你需要保
+ ^8 x1 T) H& G* z I& } t证客户在密西哥产生的报表,则当前的日期格式为 Mexican Spanish 格式。你应该使用下面 ' [- H# q8 ^) {- f6 u
那个代码段实现? 4 b" z" k5 D0 ^6 A2 ?7 g- H- z
A. DateTimeFormatInfo dtfi = new CultureInfo("es-MX", false).DateTimeFormat; 0 ~; ?1 F+ V: s6 \
DateTime dt = new DateTime(DateTime.Today.Year, DateTime.Today.Month, ( x( x0 `+ v. G/ z) p7 @
DateTime.Today.Day); string dateString = dt.ToString(dtfi.LongDatePattern);
' Z& b$ Q! Z5 F1 x' U8 KB. Calendar cal = new CultureInfo("es-MX", false).Calendar; DateTime dt = new
2 x9 x: u; d: ^0 n1 R. vDateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day); Strong 0 l. {- c) z0 G: H! j) |* c( v
DateString = dt.ToString();
4 L/ a r- u% q6 R9 IC. string dateString = DateTimeFormatInfo.CurrentInfo
3 f/ i% m4 D+ X( k$ w' x6 B5 BGetMonthName(DateTime.Today.Month);
5 M4 X, o3 v) H3 J7 q2 H; R* `1 n) U9 ~D.string dateString = DateTime.Today.Month.ToString("es-MX"); 5 A1 v3 p% L7 N9 E
答案: A 4 o: k# J: f B- b7 c
+ E2 e! w. J6 s+ A' J第 57 题 5 Q1 }, [' k* X7 S# Z
你正在创建一个应用,它从应用配置文件的自定义节中读取值。XML 自定义节如下: * ~2 J' T1 d7 A' ^
* Q9 L2 h; G% P% k
6 Q' c' g( w8 f# E* v. d
" m6 | {) W( p, @* _3 p) _ + K* t( X F: R2 |0 }0 S( B( c
: u, O: U$ |* @1 r3 a# A3 x
你需要写一个代码段去定义一个名为Role 的类。而且你需要保证Role类使用从配置文件自定义 ' h5 K! v. B, }5 \8 |! n
节读取的数据进行初始化。你应该使用下面那个代码段?
) L* s& k; u* s4 r! {A. public class Role : ConfigurationElement - w$ b( d. r r% n6 U4 l
{
b- k `! u. E1 T Q+ Ginternal string_ElementName = "name"; 5 T" c: i! Q T2 f+ W6 G; X
[ConfigurationProperty("role")] ( R( ^4 \, `- { \+ E
public string Name
' j! G! R0 r- J% i* K+ f+ K{
+ K0 _' e* p6 i" ?2 T Lget ( f& h/ V# \5 C4 E3 t1 ^
{ : g- q& T8 `# g- L% A
return ((string)base["role"]); * o; b1 \4 m3 `! w; C! [
}
+ t) h( B+ V: L( o}
6 i [6 C: |5 J& p z* P b7 U# \} ) d" l; s) A7 R
B. public class Role : ConfigurationElement { # i2 v; w/ z- t
internal string_ElementName = "role"; & z! g( Y, b3 `; J8 z* s
[ConfigurationProperty("name", RequiredValue = true)]
' v) |( q# _' r; p/ npublic string Name { # {, \* R% v: }# |
get {
6 x. s+ F3 \. S+ V1 q! b/ G# y9 ireturn ((string)base["name"]);
0 {; t0 q8 \% a( ~+ }, o: g6 d% H* W}
6 b7 ]# G' f# Q- E3 L- X4 ?} f6 T) [2 d2 R6 [6 \
} 7 ]" V( }: ^! f$ f9 w% m! F+ t
C. public class Role : ConfigurationElement {
: l5 N: L" r G& a \internal string_ElementName = "role"; / }& i6 C4 @1 @) }- F
private String_name;
8 k# p8 q. b7 M- N& t[ConfigurationProperty("name")]
- ^( W* }: H0 Q& lpublic string Name {
! D6 }( J3 n/ C- i% F0 B- o( i! tget { & y2 i, d" g6 j3 F8 ]$ ?# }3 ~
return_name;
$ E9 h5 G- p4 l8 X}
% ]( H" u, h2 ]+ c% X; J}
& P: `" M9 |8 w}
1 x# Q1 k0 [9 q( {4 ID. public class Role : ConfigurationElement {
3 P. z9 i% Q- m2 S1 t" P' {: ^internal string_ElementName = "name"; % p, ~, j3 k9 Y. ^
private String_name;
& z. J- T( e+ S4 ~[ConfigurationProperty("role", RequiredValue = true)]
[; F) P3 w* B) a* L- t9 xpublic string Name { : j4 a5 N4 P6 |: ]) s5 z; r B
get {
/ r! Q% {, b5 q7 H) ^# {return_name;
# k4 b# ^. r% K- p" Y2 @( K} 5 ~6 n. @& T% D0 f3 D+ L# h6 G6 j
}
h$ {- x' [4 {, k; o- x} 1 m/ K. Z6 R6 _2 B
答案: B 9 o- w! w, x! N' \3 t3 I+ [
% d+ t, H; @- l6 k# h- v+ a. K, m% @1 g* U+ l/ Q* r$ X
第 58 题 2 Z) \+ s- u4 A ?
你需要从你的托管代码使用平台调用服务(platform invoke services)调用一个非托管的函数, 4 j! |7 P. Z" d# r
你应该怎么做? + K f6 }6 t' D3 O% I# o! w
A. Create a class to hold DLL functions and then create prototype methods by using managed
# `% `& z; g' ]7 y* u/ _" Q$ FCode。 9 O" u) L" d- z3 D+ n
B. 注册你的程序集为COM组件然后从COM中引用你的托管代码。 : R" Q6 F0 z$ x# ~4 o( p
C. 为你的托管代码导出类型库。
4 J- K# r! Z# o7 yD.导入类型库作为一个程序集然后创建COM对象实例。 - d/ u4 _1 E, Y
答案: A |