I wrap up by examining how you can document your types using XML attributes, and how the Visual Studio.NET IDE automatically generates Web-based documentation for your projects. Although this might not qualify as a truly “advanced” technique, it is a high note on which to end the chapter.
A Comprehensive Guide to C# and the .NET Platform
I wrap up by examining how you can document your types using XML attributes, and how the Visual Studio.NET IDE automatically generates Web-based documentation for your projects. Although this might not qualify as a truly “advanced” technique, it is a high note on which to end the chapter.
A Programmer’s Introduction to C#, Second Edition
using System.Diagnostics;
class Test
{
[Conditional("DEBUG")]
public void Validate()
{
}
}
Most programmers will use predefined attributes much more often than writing an attribute class.........
User Interfaces in C#: Windows Forms and Custom Controls
- To create controls that abstract away unimportant details and are tailored for a specific type of data. You saw this model in Chapter 6 with custom ListView and TreeView examples.
- To create controls that provide entirely new functionality, or just combine existing UI elements in a unique way. An example of this is the directory browser control developed in this chapter.
- To create controls with a distinct original look, or ones that mimic popular controls in professional applications (like Microsoft’s Outlook bar) that aren’t available to the masses. This topic is considered briefly in this chapter, and returned to in Chapter 13, with GDI+.
Creating custom controls in .NET is far easier than it has been in languages like C++ or VB, where you typically need to embrace the ActiveX model to create a truly shareable component. As most developers have found, ActiveX controls can be difficult to distribute because every version needs to be registered. Creating ActiveX controls also requires a bit of wizardry, with special care taken to handle property pages, design-time versus runtime appearance, and state management.
In .NET, creating a custom control is as easy as creating an ordinary class. You simply inherit from the best possible ancestor and add the specific features you need. Best of all, you can create a custom control class as part of an existing project, and then decide later to place it in a separate assembly that can be shared with other programmers.
This chapter introduces the different types of custom controls, and the types of problems they can solve. You will look at several key examples, including a thumbnail image viewer and a masked text box, and consider advanced techniques like creating multithreaded controls. However, you won’t learn how to make these controls behave happily in Visual Studio .NET. That topic, as well other issues like control distribution and licensing, are picked up in the next chapter.
Draft C# Language Specification
- C# is intended to be a simple, modern, general-purpose, object-oriented programming language.
- The language, and implementations thereof, should provide support for software engineering principles such as strong type checking, array bounds checking, attempts to use uninitialized variables, automatic garbage collection, and so on. Program robustness, durability, and programmer productivity are important.
- The language is intended for use in developing software components suitable for deployment in distributed environments.
- Source code portability is very important, as is programmer portability, especially for those programmers already familiar with C and C++.
- Support for internationalization is very important.
- C# is intended to be suitable for writing programs for both hosted and embedded systems, ranging from the very large that use sophisticated operating systems, down to the very small having dedicated functions.
- Although C# programs are intended to be economical with regards to memory and processing power requirements, the language was not intended to compete directly on performance and size with C or assembly language.
The development of this standard started in November, 2000. It is intended that the final version of this draft ECMA Standard will be submitted to ISO/IEC JTC 1 for adoption under its fast-track procedure. It is expected there will be future revisions to this standard, primarily to add new functionality.
Sams Teach Yourself C# in 24 Hours
Part III Making Things HappenProgramming! teaches you the nuts and bolts of C# programmingand there's a lot to learn. You'll discover how to create methods, as well has how to store data, perform loops, and make decisions in code. After you've learned the core programming skills, you'll move into object-oriented programming and debugging applications.
Part IV Working with Data introduces you to working with a database and shows you how to automate external applications such as Word and Excel. In addition, this part teaches you how to manipulate a user's file system.
Part V Deploying Solutions and Beyond shows you how to distribute an application that you've created to an end user's computer. Then, the focus is brought back a bit to take a look at Web programming and Microsoft's .NET initiative from a higher, less-technical level.
Dissecting a C# Application: Inside SharpDevelop
- Build a highly modular application
- Provide a flexible, extendable, customizable user interface
- Manage the efforts of translators for efficient internationalization
- Represent and manipulate text efficiently
- Code search and replace functionality
- Construct reusable controls
- Implement a parser to provide syntax highlighting and auto-completion as users type
- Use reflection to access information about .NET classes
- Create a Windows Forms designer
- Generate code programmatically
Data Structures and Algorithms with Object-Oriented Design Patterns in C#
- Variables
- Value Types and Reference Types
- Parameter Passing
- Classes and Objects
- Inheritance
- Interfaces and Polymorphism
- Other Features
Basic C# exposure
The grand design, as it were, is to change the very nature of the way people work presently. Today we generally use one computer per person. Soon, all we shall be using would be only the Internet. For all our needs. In other words, whenever you switch your computer on, you would be connected directly to the Internet and not your hard disk for even the most rudimentary of tasks.
The task is enormous: every package now on offer will need additional code (even recoding). In the new regime, Microsoft has got Visual Studio .Net which can enable even the most uninitiated to design complex websites provided of course one is web and design savvy.
And all of this will be made possible through a new programming language called C# (pronounced C-Sharp).
Why C-Sharp?
When people talk of computer programming languages, there is always a debate on which one is better. C++, Java, Perl, PHP3… the arguments and counter-points can be endless. However, it is our considered belief that that C# would be in a sense better than the rest. And there is a reason for this.
Normally, whenever a new product is introduced, it betters the technologies of its ilk. For existing technologies evolve with their own pros and cons. Therefore, in 1995, when Sun introduced Java, it took the best from amongst all languages and added current technology. Now Microsoft has done the same. Its taken the best features from C++ and Java and morphed them into this new programming language called C#.
Imagine those who worked on Java when it was launched six years ago. Today a CV boasting of a six-year experience in Java means the maximum possible. Simple arithmetic - Java was launched only in '95. Similarly, if you get into C# today, only a Microsoft engineer could have more working knowledge of it! Therefore, we don't think we need to elaborate further on the weight that a CV with C# exposure would command! Think for yourself. You may know of people who have struck lucky in getting a job. But when it comes to keeping it, Lady Luck is powerless.
Indeed, technology is ruthless, in that, it breaks across all age and seniority barriers. That's the reason why even a teenager could have as much experience with a new technology as a 40-year-old. Unfair, but true.
Who should read this book?
Anyone wanting to be on the cutting edge of new technology. The book is written assuming no prior programming knowledge on the part of the readers. However, we make certain other assumptions that we shall explain now.
Many a times, on a clear night when we look up at the stars, we can't help but wonder whether there is intelligent life out there - or are they just like us?
For we don't believe that intellect is a quality that we are born with. In fact we are going to share a secret with you. It is the secret of success given to us by an old gypsy woman. This magic mantra has worked with many and we assume you would also use it in your life. In fact this is the only assumption we make in this book.
The secret is in persistence - nothing in the world can take place of persistence. Talent will not, nothing is more common than unsuccessful people with talent. Genius will not, unrewarded genius is almost a proverb. Education will not, the world is full of educated derelicts. Persistence and determination alone are omnipotent. We hope you agree with the old gypsy apply the maxim while learning C#.
Now, the mere fact that you are reading this means that you are interested in learning something new. However, there is a great deal of difference between a person who wants to read a book and the person who just wants a book to read. We hope you belong to the former category.
Though we attempt to infuse a certain degree of humour in our writing, please do not buy this book for its jokes. This is no coffee table book or even bedtime reading. This is a book, a medium, which we hope will do the serious job of teaching the reader a new programming language.
And how do we propose to go about it? Just like when you eat, no matter how delicious the food in front of you is, you have to consume it, one mouthful at a time. You just cannot eat it all at once, can you?
Similarly, when learning, it is always better to take small steps - one concept at a time. Sometimes, we even repeat the same concept several times, in different ways. For we firmly believe that if you do the little things well enough, big things will come to you asking to be done.
Incidentally, the entire C# software is available on the Microsoft site, downloadable free of charge. Detailed instructions are given on the site along with a set of FAQs.
Well, that's that. We agree, it is tough to climb the ladder of success, especially if you're trying to keep your nose to the grindstone, your shoulders to the wheel, your eye on the ball and your ear to the ground. Precisely the reason why some people do not recognise opportunity - it often comes disguised as hard work.
This book presents you with precisely such an opportunity. We hope you grab it with both hands!
Fascinating concepts about C# classes
The next two chapters focus on DTD, which is an acronym for Data Type Definition, and also on the XML Data Document. They provide information on the various elements employed while generating an XML file.
The topic of XML Documentation provides a hiatus from the preceding abstruse topics. It has been laced with effervescent text and examples to liven up the proceedings.
We have applied utmost perspicacity to ensure that accurate, useful and relevant explanations, laced with lucid and practical examples, be presented to expound the various concepts to both, the amateur and the proficient programmer alike.
We assure you that, by the time you disembark from this intellectual voyage of discovery, the various concepts that have been presented, are doubtlessly bound to create an indelible imprint on your minds.