... look at a trivial illustration, shown in Example 3- 42, to explore how it works,
before we think about why we might want to use it.
Example 3- 42. Static state
public class MyClassWithAStaticProperty
{
... the data portion of our Plane by adding a property for its position, shown
in Example 3- 32.
Example 3- 32. Using our custom value type for a property
public PolarPoint3D Position
{
get;...
... 'millennium'
(Document 2)
Document traduit.
(Document 3)
Spellchecked document.
(Document 3)
Repaginated document.
(Document 3)
(Document 3)
Executed 9 processes.
OK, our production team is very ... lambda.) In C#, a lambda is really just a concise way to write
an anonymous method. We’re just writing normal code, so we can include operations
that have side effects.
So, alth...
... bigFiles)
{
Console.WriteLine(file);
}
As long as the C# file has a using System.Linq; directive at the top (and Visual Studio
adds this to new C# files by default) this code will work just fine. ... other C# code—it is, by design, somewhat reminiscent
of database queries. But it turns out that all that syntax turns into straightforward
method calls.
Query Expressions Versus Method Cal...
... Example 10- 15 asks for four digits
after the decimal point.
Example 10- 15. Fixed-point format
double amount = 152 .683 854 85;
string text = amount.ToString("F4");
This produces:
152 .6839
The ... in:
13:14
13:14
13:14: 15
13:14: 15
Or, as Example 10- 35 shows, you can combine the two.
Example 10- 35. Getting both the time and date
DateTime time = new DateTime(2001, 12, 24,...
... When it’s pressed in, the
ChatService service reference can be expanded, as Figure 13 -7 shows.
Figure 13 -7. Generated files in a service reference
The most
interesting file in here is Reference.cs, ... user’s name, so we can support
notes from people who may not be called Ian (see Example 13 -7) .
Example 13 -7. Client with input loop
static void Main(string[] args)
{
ChatServiceClient c...
... The Airbus A 380
aircraft has FAA and EASA approval to carry 85 3 passengers, which suggests that even
with our uncommonly decisive passengers, that’s still a total of more than 28 hours of
decision ... 14-23. Client-side WCF Data Services code
var ctx = new AdventureWorksLT2008Entities(
new Uri("http://localhost:1 181 /MyData.svc"));
var customers = from customer in ctx.Custome...
... But
Silverlight 4 supports C# 4.0, and all script objects can now be used through the
dynamic keyword, as Example 18 -9 shows.
Example 18 -9. Accessing JavaScript in C# 4.0
dynamic window = HtmlPage.Window;
window.showMessage("Hello, ... wordApp.Documents.Open("WordFile .docx& quot;, ReadOnly:true);
in C# 3.0 you would have been forced to write the considerably less attrac...
... and instead
will just act as the base for a derived class. This kind of class is known as an ab-
stract class. An abstract class is useful when a program designer wants to ensure
that certain functionality ... 6-5.
Chapter 6
132
NOTE Keep in mind that although a class can inherit characteristics from
a chain of parents, the parents’ constructors are not called automatically
when you...