第 56 题 : z- Y0 J2 v& f4 C% b" U( x
你正在为一个客户开发一个财务报表。你的客户在美国有总部,在密西哥有分部。你需要保
5 y1 B- `; X, g" ^, `6 _# s; @证客户在密西哥产生的报表,则当前的日期格式为 Mexican Spanish 格式。你应该使用下面
( w" N2 O- f' r+ c, \1 U那个代码段实现? - t# O( S B3 q
A. DateTimeFormatInfo dtfi = new CultureInfo("es-MX", false).DateTimeFormat;
2 c4 @$ I, ?% c# QDateTime dt = new DateTime(DateTime.Today.Year, DateTime.Today.Month,
" X& K( X/ g1 u$ P6 d qDateTime.Today.Day); string dateString = dt.ToString(dtfi.LongDatePattern);
5 X* o& k% B8 d! n$ TB. Calendar cal = new CultureInfo("es-MX", false).Calendar; DateTime dt = new 8 e, Q+ |1 P7 |! N
DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day); Strong : K4 ]- X u- @! J1 u% I
DateString = dt.ToString(); - I: N- \0 t" o$ S% x1 Z, a
C. string dateString = DateTimeFormatInfo.CurrentInfo 4 g8 U6 t' y s8 \7 s! [2 P. E
GetMonthName(DateTime.Today.Month); - O% C) s3 O$ O ~) g0 q
D.string dateString = DateTime.Today.Month.ToString("es-MX");
4 [. \- E; p! f e& N答案: A : e7 b3 B9 T7 Z! f
+ |3 l) f" F2 e- G9 a2 R+ F" K
第 57 题 ) P T6 G* b, Q+ L Y0 _& ^
你正在创建一个应用,它从应用配置文件的自定义节中读取值。XML 自定义节如下: ! G( Q$ k# _+ f) C- I( g
4 _3 ]* O. z9 z2 W! [8 w( m$ b 5 }2 k* u( J$ p3 b/ t' I: J4 l
) S; n! t N4 a4 q9 V' q; O
# F) Y; ~4 h7 i+ L7 K/ D0 \
7 r, n( Y4 t' O$ n. J& b
你需要写一个代码段去定义一个名为Role 的类。而且你需要保证Role类使用从配置文件自定义 $ N; _: W, ? u l
节读取的数据进行初始化。你应该使用下面那个代码段?
1 H' B9 p& K8 d2 E1 AA. public class Role : ConfigurationElement
: L d. W: W2 M, ~. O' f; l! g{ / K7 P+ m- e: {% I; r/ O3 }
internal string_ElementName = "name"; . o# m; Q: `1 z' W2 B
[ConfigurationProperty("role")]
9 _. q0 u* y8 M6 ?public string Name ! F; i- M$ L0 R0 W
{ % W) o9 {+ ?- |* p
get + h& s/ ~( @; M4 v% g! o
{
& J" T `( J. i* G& D% B, _: Dreturn ((string)base["role"]); 0 |9 h2 q/ \% k. _: f) D
} ' M* R+ ]# D& b5 J/ G/ o' y, O$ h" s
}
, k) }% S. e0 s6 \}
d6 n2 Y6 g, b# @, k# A. T. bB. public class Role : ConfigurationElement {
( t6 A' S) Q5 einternal string_ElementName = "role"; 7 ^# T/ d4 H+ b* f3 h, d2 V" S
[ConfigurationProperty("name", RequiredValue = true)] - D' q* ]% }9 k2 G6 m5 x9 i$ s" Y3 T, _5 I
public string Name {
) J }: J. r3 }, Uget {
2 ~7 M! `+ S; e* J# P. O( |return ((string)base["name"]); 9 d M2 g. W; D C5 R1 K4 m
}
2 t8 e C' n5 q" R}
( b+ @( D$ t4 w} - p- G- f% f$ U1 i
C. public class Role : ConfigurationElement {
5 |9 X+ K( S8 l. W$ L1 w& {: xinternal string_ElementName = "role";
. H7 V9 q5 ^6 S6 q1 f, l, |) Kprivate String_name;
5 `7 u( |8 n( Y% ~$ a[ConfigurationProperty("name")]
5 B* o; ]7 A- F4 q: n, b2 Jpublic string Name {
Q9 d/ V0 a$ V" e; Aget {
0 e: C9 V4 t2 \7 i lreturn_name; 3 J. }8 A0 ^5 ?
} 8 a: G' O" t4 f, O
} 4 H+ S% l& I; T \4 s. s8 u
} : s+ p4 S3 g" j& F
D. public class Role : ConfigurationElement { 1 N+ r2 o& ]3 e) g6 g8 l/ A
internal string_ElementName = "name";
( W4 c5 E) B4 Q0 h% Q* ]" ?6 mprivate String_name;
8 X! k- d% z( F# b, E& `4 Y2 Y: D[ConfigurationProperty("role", RequiredValue = true)]
5 n. `3 ~; J% q* f3 l- z# ppublic string Name {
8 H3 Z& {3 x, uget {
/ r2 W- U( e2 qreturn_name; 5 i4 i9 ?0 z2 q& B
}
3 h, T$ e! q4 T) T) A/ `0 S} 4 G8 T( a1 c5 I. u, S6 E
}
0 f7 [. a" _. ^$ c+ E" E答案: B
8 Z3 E7 w- ]: f' o s
) C7 }5 o5 k- W
% S) B; `2 O! ~+ }3 Q7 j# \! I) I第 58 题
8 g5 A- z4 ~ e' W' D3 t你需要从你的托管代码使用平台调用服务(platform invoke services)调用一个非托管的函数,
, B# h% J; K& b& K+ }+ k: _你应该怎么做? ( O1 h4 f; v E- K: r0 Z2 w. j
A. Create a class to hold DLL functions and then create prototype methods by using managed 7 @% f" Z$ c# e( v1 O$ V
Code。 / y- `6 Z0 |, B
B. 注册你的程序集为COM组件然后从COM中引用你的托管代码。
5 [# N- A* r; D8 |8 e; K, z8 bC. 为你的托管代码导出类型库。
& Z/ O6 m9 n+ r8 c( f) h0 vD.导入类型库作为一个程序集然后创建COM对象实例。 5 D- ?% Y. O1 q0 G
答案: A |