C Sharp Review Questions
... following code is meant to handle exceptions Explain why this code is not correct try { … } catch(Exception){…} catch(IOException){…} Select answer : We can’t use the type of IOException class as catch ... Sorting Caching Bubbling Question 20 : Difference between the C# statements “catch(Exception ex){}” and “catch{}”? A try statement can only have one catch{} statement(general catch clause) general clause; ... [ambiguous call’static MainClass()’ and ‘MainClass()’] Instance Static Instance Static Static instance Question 94 : What is the output of following C# code? class MainClass { static void Main()...
Ngày tải lên: 21/08/2012, 15:55
... this.FullPath.Equals("")) ///throw exception throw new Exception("Can not get content! The file is not define or declare."); else{ ///check file exists, throw exception if it isn't exist if (System.IO.File.Exists(this.FullPath)) ... ///throw exception throw new Exception("Can not get content! The file can not be found."); } ///return result return _sResult; } /// /// Get file content /// orverload fileContent method ... (System.IO.File.Exists(this.FullPath)) { ///Create filestream with filemode open and fileaccess read FileStream _oFileStream = new FileStream(this.FullPath, FileMode.Open, Fi leAccess.Read); ///Create byte array Byte[]...
Ngày tải lên: 15/12/2013, 01:16
... instances of a class are created, its static constructor will only be called once All nonstatic constructors are also known as instance constructors 28 public class Bus Ví dụ { // Static constructor: ... public void NonStaticMethod( ) { . . .} } public class Tester() { CSharp cs = new CSharp( ); Truy c p qua thể hiện: cs cs.NonStaticMethod( ); CSharp.StaticMethod( ); Truy c p qua tên lớp: CSharp } 44 // cs_static_keyword.cs ... MyBaseClass.MyBaseClass() constructor will execute ➤ The MyDerivedClass.MyDerivedClass() constructor will execute 23 Ví dụ MyDerivedClass myObj = new MyDerivedClass(4, 8); Chuôi cac constructor...
Ngày tải lên: 21/06/2014, 09:20
Lập trình cơ sở dữ liệu C Sharp-Phần 4 pdf
... thư c thi giao diên IComparable< T > cac đôi tượng ̣ ́ ́ Icomparable có thể dung với phương thư c sort và search ̀ cua cac lớp System.Collections.Generic ̉ ́ Cac loai dữ liêu thư c thi IComparable< ... interface is contra-variant Concrete classes can implement closed constructed interfaces, as follows: interface IBaseInterface { } class SampleClass : IBaseInterface { } 33 Generic Interfaces ... Interface can apply for Generic Interfaces Generic containers create much more efficient code than nongeneric containers when they contain value types A interface has a generic type form: Public interface...
Ngày tải lên: 21/06/2014, 09:20
Giải thuật C Sharp.pdf
... password c thông báo password Ø Ngư c lại c passwd t ì kiểm tra c ch h so sánh chuỗi với nhau: _ Nếu cho số chọn cho t c độ phù hợp với _ Nếu không cho thông báo messagebox báo nhập sai cho chơi ... trò chơi Ta cho c FLAGS=TRUE trường hợp dầu chưa chảy f_start = TRUE; // cho dầu chảy ống khởi đầu f_killtimer = FALSE;// c hủy Timer để thông báo f_xoa = FALSE; // c xóa ống chưa c dầu chảy ... man khung combobox !"); switch(atoi(m _chonsoman)) { case : if(m_tenpasswd.Compare("son")==0) { pch .c_ man = 4; pch .c_ diem = 0; pch.n_tocdo = (2000-200); pch.status =0; pch.reset(); } else if(MessageBox("Password...
Ngày tải lên: 23/08/2012, 13:21
100 c interview questions answers
... res=1/5+1/4+1/3+1/2+1/1+1/0; ^ | zero divide occur 36 ans: (b) reason: ' %c' mainly used for print one charactor We can't specify formate output within ' %c' 37 ans: (b) reason: can not modify constant value It is a ... (b) reason: stack concept 85 ans: (b) 86 ans: (a) 87 ans: (c) 88 ans: (c) 89 ans: (a) 90 ans: (a) 91 92 93 ans: (c) 94 ans: (d) reason: message[] is correct 95 ans: (c) reason: static is not allowed ... 25 ans: (c) reason: c+ +100 is not valid as c= c+100 26 ans: (d) 27 ans: (a) 28 ans: (b) 29 ans: (a) 30 ans: (c) 31 ans: (d) 32 ans: (e) reason: incompatiable type conversions 33 ans: (c) reason:...
Ngày tải lên: 07/02/2013, 09:37
Tài liệu C Sharp part6 pdf
... 7: locals (class yyy V_0,class yyy V_1,class yyy V_2) 8: ldc.i4.s 10 9: newobj instance void yyy::.ctor(int32) 10: stloc.0 11: ldc.i4.5 12: newobj instance void yyy::.ctor(int32) 13: stloc.1 14: ... 13: stloc.1 14: ldloc.0 15: ldloc.1 16: call class yyy yyy::op_Addition(class yyy,class yyy) 17: stloc.2 18: ldloc.2 19: ldfld int32 yyy::i 20: call void [mscorlib]System.Console::WriteLine(int32) ... } 25: 26: class public auto ansi yyy extends [mscorlib]System.Object 27: { 28: field public int32 i 29: method public hidebysig specialname static class yyy op_Addition(class yyy x,class yyy...
Ngày tải lên: 15/12/2013, 02:15
Apress Expert C sharp 2005 (Phần 3) pdf
... base classes Csla.Core.IReadOnlyCollection Interface implemented by all read-only collection base classes Csla.Core.ICommandObject Interface implemented by CommandBase Csla.Core.ObjectCloner Clones ... implements Csla.Core.IUndoableObject Cascading the Call to Child Objects or Collections If the field is a reference to a Csla.Core.IUndoableObject, the CopyState() call must be cascaded to that object, ... UI code ICommandObject Interface The final common interface is ICommandObject Like IReadOnlyCollection, this is an empty interface: interface ICommandObject : IBusinessObject { } Again, you can...
Ngày tải lên: 06/07/2014, 00:20
Apress Expert C sharp 2005 (Phần 5) pdf
... (T)Create(typeof(T), criteria); } public static T Create() { return (T)Create(typeof(T), null); } public static object Create(object criteria) { return Create(MethodCaller.GetObjectType(criteria), criteria); ... EnterpriseServicesPortal class is a base class the application can use to easily create a server-side object to host in COM+ This way, the client application can reference its specific server-side object ... strongly typed result and the actual implementation: public static T Fetch(object criteria) { return (T)Fetch(criteria); } public static object Fetch(object criteria) { Server.DataPortalResult...
Ngày tải lên: 06/07/2014, 00:20