Mega Code Archive
Search
.Net
ASP .Net
ASP .Net Tutorial
C#
C# Book
C# by API
C# Tutorial
VB.Net
VB.Net by API
VB.Net Tutorial
Visual C++ .Net
VisualBasic Script
Java
Java
Java Book
Java by API
Java Tutorial
Script
Flash ActionScript
Flex
JavaScript DHTML
JavaScript Reference
JavaScript Tutorial
Database
MSSQL
MSSQL Tutorial
MySQL
MySQL Tutorial
Oracle PLSQL
Oracle PLSQL Tutorial
PostgreSQL
Languages
Android
C
C Tutorial
C++
C++ Tutorial
Delphi
Perl
PHP
Python
Python Tutorial
Ruby
Silverlight
Office
MSOfficeExcel 2007 Tutorial
MSOfficePowerPoint 2007 Tutorial
MSOfficeWord 2007 Tutorial
Data
XML
XML Tutorial
C#
Class Interface 284 codes
Home
C#
Class Interface
1 A base class reference can refer to a derived class object
2 A better way to overload !, and & for ThreeD This version automatically enables the && and operators
3 A multilevel hierarchy
4 A multilevel hierarchy 1
5 A parameterized constructor
6 A program that uses the Building class
7 A public constructor initializes private instance variable balance through public property
8 A safe method of determining whether a class implements a particular interface
9 A Simple C# Class
10 A Simple Class and Objects
11 A simple class hierarchy
12 A simple constructor
13 A simple example of recursion
14 A simple example that uses a parameter
15 A simple inventory example
16 A simple property example
17 A two-dimensional fail-soft array
18 Abstract Classes and Methods
19 Access to a private field through a property
20 Add a constructor to Building
21 Add a constructor to Triangle
22 Add a method that takes two arguments
23 Add a method to Building
24 Add an indexer in an interface
25 Add constructors to TwoDShape
26 Add Length property to FailSoftArray
27 Add more constructors to TwoDShape
28 An example of inheritance-related name hiding
29 An example of operator overloading
30 Assign value to class
31 Automatic type conversions can affect overloaded method resolution
32 Bank Account class is abstract since there is no single implementation for Withdrawal
33 Build a derived class of Vehicle for trucks
34 C# always creates a structure instance as a value-type variable even using the new operator
35 C# Class Constructor Overloading
36 C# Classes Member Functions
37 C# Properties and Indexers
38 Call a hidden method
39 Call class methods 2
40 Calling a Class Method on a Class
41 Calling a Function with a Structure Parameter
42 Calling an Instance Method on an Object
43 Can call a non-static method through an object reference from within a static method
44 Casting Objects
45 Catch NullReferenceException Exception
46 Change field value in a method
47 Check the parameter in construtor
48 Class a class method
49 Class declaration maintains the time in 24-hour format and ToString Method
50 Class declaration with a public method that has a parameter
51 Class declaration with one public method
52 Class hierarchy
53 Class Hierarchy test
54 Class Hierarchy with two children class
55 Class variables with default value
56 Clone an Object
57 Collection is iterated using the IEnumerator interface
58 Constructor initializers are called bottom-up but the constructors are invoked top-down starting with the constructor in t
59 Constructor overloading 3
60 Conversions Between Structs 1
61 Conversions Between Structs 2
62 Convert errflag into a property
63 Copy a class
64 Copy a struct
65 Create a specifiable range array class
66 Create an abstract class
67 Create class
68 Custom Serialization using ISerializable
69 Declare a class Address containing the data members to describe a US address along with the member functions
70 Declare class and use it
71 Declaring and Defining Classes
72 Declaring Class Instances
73 Default Values of Class Member Variables
74 Define indexer
75 Define methods that return a value and accept parameters
76 Define properties for class
77 Define struct and use it
78 Defining functions for structs
79 Delegates as Static Properties
80 Demonstates assignment operator on structures and classes
81 Demonstrate a destructor
82 Demonstrate a structure
83 Demonstrate a virtual method
84 Demonstrate an overloaded constructor
85 Demonstrate ICloneable
86 Demonstrate invoking a constructor through this
87 Demonstrate method overloading
88 Demonstrate protected
89 Demonstrate readonly
90 Demonstrate the ByTwos interface
91 Demonstrate the ByTwos interface 2
92 Demonstrate the use of a nested class to contain data
93 Demonstrate ToString()
94 Demonstrate when constructors are called
95 Demonstrates a custom constructor function for a structure
96 Demonstrates access to static and non-static members
97 Demonstrates deriving a new class from a base class in another assembly
98 Demonstrates how a static field is shared by multiple instances of a class
99 Demonstrates overloading the addition operator for two class objects
100 Demonstrates overriding the ToString() method to provide a custom string output
101 Demonstrates the use of a simple interface
102 Demonstrates the use of a virtual method to override a base class method
103 Demonstrates the use of a virtual property to override a base class property
104 Demonstrates the use of properties to control how values are saved in fields
105 Demonstrates use of static constructor
106 Demonstrates using a structure to return a group of variables from a function
107 Demonstrates using the this intrinsic variable, which allows a class instance to identify itself
108 Demostrates the use of an abstract class, including an abstract method and abstract properties
109 Derived Disposable Classes
110 Downcast will fail
111 Enum based attribute
112 Enumerator Example (Versioned Collection)
113 Error handling in property setter validating
114 Error using static
115 Explicitly implement an interface member
116 Extends IEnumerable
117 Field Attributes
118 Finalizable Disposable Class
119 Force the GC to invoke Finalize() for finalizable objects created in this AppDomain
120 Format data in ToString method
121 Four layers of class hierarchy
122 Gets the hash code for an object using a comparer Correctly handles null
123 IEnumerable with a foreach loop
124 IEnumerator Example (Static Collection)
125 Illustrates a copy constructor
126 Illustrates a destructor
127 Illustrates abstract classes and methods
128 Illustrates an explicit interface member implementation
129 Illustrates casting an object to an interface
130 Illustrates deriving an interface from multiple interfaces
131 Illustrates deriving an interface from one interface
132 Illustrates hiding
133 Illustrates how to assign default values to fields using initializers
134 Illustrates how to declare classes, object references, and create objects
135 Illustrates how to define a constructor
136 Illustrates how to override the ToString() method
137 Illustrates how to use a has a relationship
138 Illustrates implementing multiple interfaces
139 Illustrates inheritance
140 Illustrates inheriting from a class and implementing multiple interfaces
141 Illustrates interface member hiding
142 Illustrates interfaces
143 Illustrates member accessibility
144 Illustrates member hiding
145 Illustrates method overloading
146 Illustrates nested classes
147 Illustrates operator overloading
148 Illustrates overloaded constructors
149 Illustrates polymorphism
150 Illustrates sealed methods
151 Illustrates the use of a property
152 Illustrates the use of a struct
153 Illustrates the use of an indexer
154 Illustrates the use of an indexer 1
155 Illustrates the use of static members
156 Illustrates the use of the this object reference
157 Illustrates the use of various access modifiers
158 Illustrates versioning
159 Implement ICloneable, IComparable
160 Implement IComparer
161 Implements an indexer and demonstrates that an indexer does not have to operate on an array
162 Implements an indexer in a class
163 Implements ICloneable
164 Implements IComparable
165 Implements ICustomFormatter
166 Indexed properties
167 Indexer
168 Indexer with complex logic
169 Indexers dont have to operate on actual arrays
170 Indexing with an Integer Index
171 Indexing with an String Index
172 Indexing with Multiple Parameters
173 Inheritance 3
174 Interface casting
175 Interface demo
176 Interface with event
177 Interface with method name conflicts
178 Interfaces
179 Issue an error message if you do not initialize all of the fields in a structure
180 Iterates a collection forward and reverse
181 Iterates two collections simultaneously
182 Member Accessibility
183 Member Hiding
184 Message class
185 Method Attributes
186 Method overloading test
187 Method override 3
188 More operator overloading
189 Multiple constructors in a class definition
190 MyClass class that contains a private courseName instance variable, and a property to get and set its value
191 MyClass class with a public constructor to initialize the course name
192 NET Frameworks Overview
193 Object assignment
194 Object Copy and Clone
195 Object ReferenceEquals Method
196 One interface can inherit another
197 Operator Overloading
198 Overload != operator
199 Overload addition for object + object, and for object + int
200 Overload shift operator
201 Overload the + for object + object, object + int, and int + object
202 Overload the FailSoftArray indexer
203 Overload true and fase for ThreeD
204 Overloaded methods with identical signatures cause compilation errors, even if return types are different
205 Overloaded operator
206 Overloaded operator + takes two fractions
207 Overloading Classes
208 Override Properties
209 Overriding Interfaces
210 Overriding the ToString() Method
211 Pass a derived class reference to a base class reference
212 Pass by ref for object parameters
213 Persons Info class
214 Point class
215 Point object
216 Polymorphism
217 Private field and public Property in inheritance
218 Properties
219 Properties Accessors
220 Protecting Against Double Disposal
221 Public vs private access
222 ReadOnly Fields
223 Readonly Property
224 Reimplementation of Interfaces
225 Return an array
226 Return an object
227 Return class object from indexer
228 Return IEnumerable
229 Return IEnumerable by yield
230 Sealed Methods
231 Show name hiding in a derived class
232 Shows that stack unwinding in C# does not necessarily call destructors
233 Shows the order in which constructors and destructors are called in a C# program
234 Simulate a bank account
235 Sorting and Searching
236 Static class variable
237 Static members are frequently used as counters
238 Structs (Value Types)
239 Structs And Enums
240 Structures are good when grouping data
241 System Array and the Collection Classes
242 Test abstract class
243 Test Polymorphism Virtual Functions
244 The constructor initializes the internal object The Dispose method closes the file resource The destructor delegates to th
245 The destructors are called bottom-up, which confirms the sequencing of destructors
246 The Dispose Pattern
247 The IDisposable Interface
248 The overridden methods of the System Object class
249 The super-string class
250 The use of an abstract property
251 The use of readonly fields
252 This code raises an exception at run time because of an invalid cast
253 This program creates two Building objects
254 Three dimensional Vector with IFormattable
255 Tree Enumerator
256 Two class inherit one interface
257 Two dimensional indexer
258 Use a class factory
259 Use a property in an interface
260 Use a static class factory
261 Use a static constructor
262 Use a static field to count instances
263 Use an indexer to create a fail-soft array
264 Use explicit implementation to remove ambiguity
265 Use properties to set and get private members
266 Use static
267 Use static method to initialize field
268 Use virtual methods and polymorphism
269 User-defined public method
270 Uses a class from Example16_3a cs
271 Using Access Modifiers
272 Using base to overcome name hiding
273 Using Initializers
274 Using interface 3
275 Using statement with IDisposable interface
276 Using the this Object Reference
277 Using variable-length argument lists
278 Variable in and out a class
279 Variables of type object can accept values of any data type
280 Virtual and overload
281 Virtual keyword can be used to start a new inheritance ladder
282 When a virtual method is not overridden, the base class method is used
283 Yield IEnumerator
284 Yield return