This document discusses attributes and reflection in C#. It begins by explaining what attributes are and how they can be used to associate declarative metadata with code entities. It then provides examples of using predefined attributes like Obsolete. It discusses user-defined attributes and the AttributeUsage attribute. It covers conditional methods and the Conditional attribute. The document explains reflection and how the Type class is central to it. It provides examples of using reflection to identify types that implement an interface or are subclasses of a given type. It concludes with a test case that gets the constructors of the String class using reflection.
The document discusses XML and methods for working with XML nodes in .NET. It provides an example of programmatically creating an XML node by first creating element, attribute, and document objects, appending the attribute to the element, appending the element to the root node, and saving the XML file. It also shows how to select and retrieve values from existing XML nodes to populate object properties.
The document discusses various web technologies including HTML5, CSS, JavaScript, jQuery, ASP.NET, MVC pattern, and more. It provides an overview of each topic with definitions and examples. It also includes a brief history and future directions of web standards.
What is the DOM?
The DOM is a W3C (World Wide Web Consortium) standard.
The DOM defines a standard for accessing documents:
"The W3C Document Object Model (DOM) is a platform and language-neutral interface that allows programs and scripts to dynamically access and update the content, structure, and style of a document."
The W3C DOM standard is separated into 3 different parts:
Core DOM - standard model for all document types
XML DOM - standard model for XML documents
HTML DOM - standard model for HTML documents
The HTML DOM (Document Object Model)
When a web page is loaded, the browser creates a Document Object Model of the page.
The HTML DOM model is constructed as a tree of Objects.
With the HTML DOM, JavaScript can access and change all the elements of an HTML document.
Rich Internet Applications con JavaFX e NetBeans Fabrizio Giudici
JavaFX is a software platform for creating rich internet applications (RIAs) using Java that can compete with Flash/Flex and Silverlight, it is based on Java and the JavaFX runtime and includes tools like JavaFX Script for building the user interface and NetBeans as an integrated development environment. JavaFX aims to simplify building RIAs with features like bindings, listeners and components while allowing access to the full Java runtime.
The document discusses JavaFX Mobile and provides an overview of its features and current status. It summarizes a speaker's presentation on designing a JavaFX Mobile application and examples shown, including calling JME code, posting content via HTTP requests, and loading resources via binding. While JavaFX Mobile was promising in 2009-2010, its future is uncertain given the dominance of Android and iOS. The speaker plans to research porting their application to Android and JME to catch platforms not adopting newer technologies.
This document provides an introduction to JavaScript. It discusses the purposes of JavaScript including making web pages interactive by manipulating pages or responding to user actions. It covers basic JavaScript syntax including variables, data types, operators, conditional statements, and functions. It also discusses event-driven programming in JavaScript and how to attach JavaScript functions to HTML elements as event handlers.
This has been presented in association with Robosepians for Java concepts. Basic concepts of Java including features, conditional statements, loop statements, arrays, string, primitive datatypes, essentials of Java including oops concepts, classes, objects, polymorphism, advance topics including packages, exception handling, multihtreading and network programming have been discussed.
RequireJS & Handlebars
This presentation has been developed in the context of the Mobile Applications Development course, DISIM, University of L'Aquila (Italy), Spring 2013.
http://www.ivanomalavolta.com
The document discusses XML and methods for working with XML nodes in .NET. It provides an example of programmatically creating an XML node by first creating element, attribute, and document objects, appending the attribute to the element, appending the element to the root node, and saving the XML file. It also shows how to select and retrieve values from existing XML nodes to populate object properties.
The document discusses various web technologies including HTML5, CSS, JavaScript, jQuery, ASP.NET, MVC pattern, and more. It provides an overview of each topic with definitions and examples. It also includes a brief history and future directions of web standards.
What is the DOM?
The DOM is a W3C (World Wide Web Consortium) standard.
The DOM defines a standard for accessing documents:
"The W3C Document Object Model (DOM) is a platform and language-neutral interface that allows programs and scripts to dynamically access and update the content, structure, and style of a document."
The W3C DOM standard is separated into 3 different parts:
Core DOM - standard model for all document types
XML DOM - standard model for XML documents
HTML DOM - standard model for HTML documents
The HTML DOM (Document Object Model)
When a web page is loaded, the browser creates a Document Object Model of the page.
The HTML DOM model is constructed as a tree of Objects.
With the HTML DOM, JavaScript can access and change all the elements of an HTML document.
Rich Internet Applications con JavaFX e NetBeans Fabrizio Giudici
JavaFX is a software platform for creating rich internet applications (RIAs) using Java that can compete with Flash/Flex and Silverlight, it is based on Java and the JavaFX runtime and includes tools like JavaFX Script for building the user interface and NetBeans as an integrated development environment. JavaFX aims to simplify building RIAs with features like bindings, listeners and components while allowing access to the full Java runtime.
The document discusses JavaFX Mobile and provides an overview of its features and current status. It summarizes a speaker's presentation on designing a JavaFX Mobile application and examples shown, including calling JME code, posting content via HTTP requests, and loading resources via binding. While JavaFX Mobile was promising in 2009-2010, its future is uncertain given the dominance of Android and iOS. The speaker plans to research porting their application to Android and JME to catch platforms not adopting newer technologies.
This document provides an introduction to JavaScript. It discusses the purposes of JavaScript including making web pages interactive by manipulating pages or responding to user actions. It covers basic JavaScript syntax including variables, data types, operators, conditional statements, and functions. It also discusses event-driven programming in JavaScript and how to attach JavaScript functions to HTML elements as event handlers.
This has been presented in association with Robosepians for Java concepts. Basic concepts of Java including features, conditional statements, loop statements, arrays, string, primitive datatypes, essentials of Java including oops concepts, classes, objects, polymorphism, advance topics including packages, exception handling, multihtreading and network programming have been discussed.
RequireJS & Handlebars
This presentation has been developed in the context of the Mobile Applications Development course, DISIM, University of L'Aquila (Italy), Spring 2013.
http://www.ivanomalavolta.com
Hibernate inheritance and relational mappings with examplesEr. Gaurav Kumar
Topics included in presentation:
1. Hibernate mappings.
2. Type of mappings(Bidirectional and Unidirectional)
a. One to Many
b. One to one
c. Many to many
3. Inheritance in Hibernate
a. table per class hierarchy
b. table per subclass
c. table per concrete class
This document provides best practices for writing JavaScript code. It recommends using strict comparison operators (=== and !==), declaring variables with 'var' to avoid globals, adding comments with /* */, using object literals for configuration, validating external data, optimizing loops, and using dot and bracket notation wisely based on property visibility. Braces {} should be used to clearly delimit blocks. Variable types should not be changed after declaration and shortcuts like conditionals (?:) can optimize code.
- Hibernate is an ORM tool that uses POJO objects and allows working with objects instead of directly with the database.
- It uses a SessionFactory to provide Sessions which represent a single unit of work and handles dirty checking. Mapping is defined in XML files.
- Hibernate supports complex queries using the Criteria interface to create restrictions and conditions equivalent to SQL queries.
This document provides an overview of functions in JavaScript. It discusses functions as objects that have a [[Call]] property allowing them to be executed. It describes function declarations vs expressions and how declarations are hoisted. Functions can be treated as values that can be assigned to variables or passed as arguments. Parameters and the arguments object are covered. The document also discusses mimicking function overloading, using functions as object methods, and how the this keyword works differently depending on how a function is called using call, apply, or bind.
JSR-299 defines a unifying dependency injection and contextual lifecycle model for Java EE 6. It allows injection of various types of objects like classes, EJBs, producer methods, resources, etc. It also defines concepts like qualifiers, scopes, events, interceptors, and stereotypes to customize injections. Producers are used as sources of injectable objects and can be annotated with scopes and qualifiers.
Hibernate is an object-relational mapping tool that allows Java objects to be persisted to a relational database. It provides transparent persistence by handling all database operations like insert, update, delete, and retrieval. Hibernate sits between the Java application and database, mapping objects to database tables and allowing developers to work with objects rather than directly with SQL statements. Configuration files define the mappings between Java classes and database tables. Hibernate uses these mappings to automatically generate SQL to load and store objects.
The document discusses secrets and techniques for JavaScript libraries. It covers topics like the JavaScript language, cross-browser code, events, DOM traversal, styles, animations, distribution, and HTML insertion. It provides examples and explanations of techniques for class creation, timers, options, subclassing, custom events, selector internals, computed styles, and dimension calculations.
This document describes KAAccessControl, a framework for managing user access control and permissions. It provides concise summaries in 3 sentences or less that provide the high level and essential information from the document.
The framework allows defining roles, profiles, lists and managing user permissions through annotations and configuration files. It handles authentication but does not provide the authentication mechanism. The framework manages the current user's profile and permissions and allows impersonating other users through its user service class. Components check permissions by annotating allowed roles and querying the framework's access control services.
JavaScript was designed to add interactivity to HTML pages. It is a scripting language that is usually embedded directly into HTML pages and allows for dynamic text, event handling, reading/writing HTML elements, and validating form data. JavaScript supports both client-side and server-side scripting and was originally developed by Netscape under the name LiveScript before being renamed. It provides programming capabilities to HTML authors and allows for dynamic content, user interaction, and validation without server requests.
JavaScript is a scripting language that allows dynamic interactivity on web pages. It was invented by Brendan Eich and can be used to create image galleries, layout changes, and button click responses. JavaScript code can be placed between <script> tags in HTML documents or in external .js files. Some key features include client-side execution in web browsers, dynamic rendering variations across browsers, and potential security issues if not implemented carefully. Common uses of JavaScript include manipulating DOM elements, handling events, and validating forms.
The document provides an introduction and overview of Hibernate, including its architecture, configuration, object-relational mapping capabilities, querying functionality, caching, and transactions. Hibernate allows developers to work with Java objects in Java code while it handles the conversion between objects and relational data. The document outlines how to set up Hibernate and map objects and relationships to database tables.
Generally speaking, a function is a "subprogram" that can be called by code external (or internal in the case of recursion) to the function. Like the program itself, a function is composed of a sequence of statements called the function body. Values can be passed to a function, and the function will return a value.
In JavaScript, functions are first-class objects, because they can have properties and methods just like any other object. What distinguishes them from other objects is that functions can be called. In brief, they are Function objects.
The document discusses the rise of responsive single page applications (SPAs) built with HTML, CSS, JavaScript, and frameworks like AngularJS. It explains that SPAs are web apps that load on a single page like desktop apps, with content loaded asynchronously in the background without page reloads for a better user experience. SPAs are implemented using JavaScript and HTML, with ECMAScript as the standardized scripting language. The document also covers web standards defined by organizations like W3C, including HTML, CSS, XML, and how they are used to build responsive SPAs.
The document discusses different ways to include JavaScript code in HTML documents, including: placing scripts in the <head> or <body> sections; including scripts in both sections; or storing scripts in external .js files and linking to them. It then provides examples and explanations of each approach.
This document provides an overview of Angular and TypeScript. It begins with an introduction to Angular and its features like cross-platform support, speed, productivity tools, and full development story. It then compares Angular, AngularJS, and React. Next it discusses tools like NodeJS, Angular CLI, and Visual Studio Code. It covers TypeScript fundamentals like data types, variables, functions, tuples, unions, interfaces, classes, namespaces and modules. It explains Angular architecture components like components, directives, routes, services and NgModule. Finally, it wraps up with a discussion of components in Angular and the topics that will be covered in the next session.
In JavaScript, almost "everything" is an object.
-Booleans can be objects (if defined with the new keyword)
-Numbers can be objects (if defined with the new keyword)
-Strings can be objects (if defined with the new keyword)
-Dates are always objects
-Maths are always objects
-Regular expressions are always objects
-Arrays are always objects
-Functions are always objects
-Objects are always objects
Advanced Scala reflection & runtime meta-programming. The Scala compiler toolbox. Reading Scala Annotations and overcoming type erasure with some real world use cases.
Presented at BJUG, 6/12/2012 by Roger Brinkley
This talk is on 55 new features in Java 7 you (probably) didn't hear about in an ignite format of one per minute. No stopping, no going back....Questions, sure but only if time remains (otherwise save for later).
JavaScript: The Good Parts Or: How A C# Developer Learned To Stop Worrying An...Doug Jones
We rarely dive into current programming languages, touting the next new framework or the new features that will be out next year. This is about JavaScript the language as it exists today, what I picked up in going from C# to JS, and what C# picked up from JS along the way as well. It is based on Douglas Crockford's seminal book "JavaScript: The Good Parts".
Slides to understand and present Advanced .net topics with c# language. Topics like delegates, Indexer, Reflection API, Attributes, Collections in c#, File and I/O manipulation etc. are described with examples too.
Hibernate inheritance and relational mappings with examplesEr. Gaurav Kumar
Topics included in presentation:
1. Hibernate mappings.
2. Type of mappings(Bidirectional and Unidirectional)
a. One to Many
b. One to one
c. Many to many
3. Inheritance in Hibernate
a. table per class hierarchy
b. table per subclass
c. table per concrete class
This document provides best practices for writing JavaScript code. It recommends using strict comparison operators (=== and !==), declaring variables with 'var' to avoid globals, adding comments with /* */, using object literals for configuration, validating external data, optimizing loops, and using dot and bracket notation wisely based on property visibility. Braces {} should be used to clearly delimit blocks. Variable types should not be changed after declaration and shortcuts like conditionals (?:) can optimize code.
- Hibernate is an ORM tool that uses POJO objects and allows working with objects instead of directly with the database.
- It uses a SessionFactory to provide Sessions which represent a single unit of work and handles dirty checking. Mapping is defined in XML files.
- Hibernate supports complex queries using the Criteria interface to create restrictions and conditions equivalent to SQL queries.
This document provides an overview of functions in JavaScript. It discusses functions as objects that have a [[Call]] property allowing them to be executed. It describes function declarations vs expressions and how declarations are hoisted. Functions can be treated as values that can be assigned to variables or passed as arguments. Parameters and the arguments object are covered. The document also discusses mimicking function overloading, using functions as object methods, and how the this keyword works differently depending on how a function is called using call, apply, or bind.
JSR-299 defines a unifying dependency injection and contextual lifecycle model for Java EE 6. It allows injection of various types of objects like classes, EJBs, producer methods, resources, etc. It also defines concepts like qualifiers, scopes, events, interceptors, and stereotypes to customize injections. Producers are used as sources of injectable objects and can be annotated with scopes and qualifiers.
Hibernate is an object-relational mapping tool that allows Java objects to be persisted to a relational database. It provides transparent persistence by handling all database operations like insert, update, delete, and retrieval. Hibernate sits between the Java application and database, mapping objects to database tables and allowing developers to work with objects rather than directly with SQL statements. Configuration files define the mappings between Java classes and database tables. Hibernate uses these mappings to automatically generate SQL to load and store objects.
The document discusses secrets and techniques for JavaScript libraries. It covers topics like the JavaScript language, cross-browser code, events, DOM traversal, styles, animations, distribution, and HTML insertion. It provides examples and explanations of techniques for class creation, timers, options, subclassing, custom events, selector internals, computed styles, and dimension calculations.
This document describes KAAccessControl, a framework for managing user access control and permissions. It provides concise summaries in 3 sentences or less that provide the high level and essential information from the document.
The framework allows defining roles, profiles, lists and managing user permissions through annotations and configuration files. It handles authentication but does not provide the authentication mechanism. The framework manages the current user's profile and permissions and allows impersonating other users through its user service class. Components check permissions by annotating allowed roles and querying the framework's access control services.
JavaScript was designed to add interactivity to HTML pages. It is a scripting language that is usually embedded directly into HTML pages and allows for dynamic text, event handling, reading/writing HTML elements, and validating form data. JavaScript supports both client-side and server-side scripting and was originally developed by Netscape under the name LiveScript before being renamed. It provides programming capabilities to HTML authors and allows for dynamic content, user interaction, and validation without server requests.
JavaScript is a scripting language that allows dynamic interactivity on web pages. It was invented by Brendan Eich and can be used to create image galleries, layout changes, and button click responses. JavaScript code can be placed between <script> tags in HTML documents or in external .js files. Some key features include client-side execution in web browsers, dynamic rendering variations across browsers, and potential security issues if not implemented carefully. Common uses of JavaScript include manipulating DOM elements, handling events, and validating forms.
The document provides an introduction and overview of Hibernate, including its architecture, configuration, object-relational mapping capabilities, querying functionality, caching, and transactions. Hibernate allows developers to work with Java objects in Java code while it handles the conversion between objects and relational data. The document outlines how to set up Hibernate and map objects and relationships to database tables.
Generally speaking, a function is a "subprogram" that can be called by code external (or internal in the case of recursion) to the function. Like the program itself, a function is composed of a sequence of statements called the function body. Values can be passed to a function, and the function will return a value.
In JavaScript, functions are first-class objects, because they can have properties and methods just like any other object. What distinguishes them from other objects is that functions can be called. In brief, they are Function objects.
The document discusses the rise of responsive single page applications (SPAs) built with HTML, CSS, JavaScript, and frameworks like AngularJS. It explains that SPAs are web apps that load on a single page like desktop apps, with content loaded asynchronously in the background without page reloads for a better user experience. SPAs are implemented using JavaScript and HTML, with ECMAScript as the standardized scripting language. The document also covers web standards defined by organizations like W3C, including HTML, CSS, XML, and how they are used to build responsive SPAs.
The document discusses different ways to include JavaScript code in HTML documents, including: placing scripts in the <head> or <body> sections; including scripts in both sections; or storing scripts in external .js files and linking to them. It then provides examples and explanations of each approach.
This document provides an overview of Angular and TypeScript. It begins with an introduction to Angular and its features like cross-platform support, speed, productivity tools, and full development story. It then compares Angular, AngularJS, and React. Next it discusses tools like NodeJS, Angular CLI, and Visual Studio Code. It covers TypeScript fundamentals like data types, variables, functions, tuples, unions, interfaces, classes, namespaces and modules. It explains Angular architecture components like components, directives, routes, services and NgModule. Finally, it wraps up with a discussion of components in Angular and the topics that will be covered in the next session.
In JavaScript, almost "everything" is an object.
-Booleans can be objects (if defined with the new keyword)
-Numbers can be objects (if defined with the new keyword)
-Strings can be objects (if defined with the new keyword)
-Dates are always objects
-Maths are always objects
-Regular expressions are always objects
-Arrays are always objects
-Functions are always objects
-Objects are always objects
Advanced Scala reflection & runtime meta-programming. The Scala compiler toolbox. Reading Scala Annotations and overcoming type erasure with some real world use cases.
Presented at BJUG, 6/12/2012 by Roger Brinkley
This talk is on 55 new features in Java 7 you (probably) didn't hear about in an ignite format of one per minute. No stopping, no going back....Questions, sure but only if time remains (otherwise save for later).
JavaScript: The Good Parts Or: How A C# Developer Learned To Stop Worrying An...Doug Jones
We rarely dive into current programming languages, touting the next new framework or the new features that will be out next year. This is about JavaScript the language as it exists today, what I picked up in going from C# to JS, and what C# picked up from JS along the way as well. It is based on Douglas Crockford's seminal book "JavaScript: The Good Parts".
Slides to understand and present Advanced .net topics with c# language. Topics like delegates, Indexer, Reflection API, Attributes, Collections in c#, File and I/O manipulation etc. are described with examples too.
The document discusses creating and using custom attributes in C#. It explains how to define a custom attribute class, apply the AttributeUsage attribute, name and construct the attribute, and apply it to a target element. It also covers retrieving metadata about custom attributes at runtime using reflection and the main uses of reflection like viewing metadata, type discovery, and late binding.
Reflection in C# allows examining and modifying program code, objects, and types at runtime without knowing their internal representations, enabling discovery of class information and accessing metadata. Key aspects of reflection include Type objects that represent types, MemberInfo classes that provide metadata about members, attributes that mark elements of code, and the System.Reflect namespace that contains classes for core reflection functionality. Reflection can be used for tasks like late binding, inspecting types, activating objects, and generating code on the fly.
Building & Designing Windows 10 Universal Windows Apps using XAML and C#Fons Sonnemans
Met het Universal Windows Platform wordt het voor jou als developer gemakkelijker om apps op maat te maken voor verschillende devices. Dankzij recente ontwikkelingen wordt het creëren van Universal Windows Apps eenvoudiger dan ooit!
XAML UI heeft met haar nieuwe controls en features een flinke stap gemaakt in het vereenvoudigen van het ontwikkelen van apps voor verschillende devices. Daarnaast is de performance geoptimaliseerd met nieuwe en verbeterde features zoals nieuwe diagnostics tools, een nieuwe Blend tool, Compiled data binding en meer!
Tijdens het seminar geeft Fons Sonnemans (trainer, developer, spreker op TechDays NL en tweemaal beloond met een Microsoft MVP award) inzicht in deze nieuwe features en tools – daar wil jij natuurlijk graag bij zijn!
.NET Attributes and Reflection - What a Developer Needs to Know...Dan Douglas
An overview of .NET Attributes and Reflection. Pro's, Con's, and when to use them along with a practical demo of .NET reflection in use.
Video demos can be found here:
http://dandouglas.wordpress.com/talks-webcasts/
This document discusses advanced C# features including delegates, events, anonymous methods, lambda expressions, anonymous types, dynamic types, and extension methods. Delegates allow type-safe callbacks and are used to handle events. Anonymous methods and lambda expressions provide concise ways to handle events without standalone methods. Anonymous types define encapsulated data without associated methods, and are typically used with LINQ. Dynamic types have members that are resolved at runtime rather than compile time, without static type checking.
We've all seen the big "macro" features in .NET, this presentation is to give praise to the "Little Wonders" of .NET -- those little items in the framework that make life as a developer that much easier!
The document discusses object-oriented programming concepts like classes, objects, encapsulation, and access modifiers. It provides examples of constructors, destructors, and copy constructors in C# and explains how they are used to initialize and cleanup class instances. It also discusses friend functions and how they allow non-member functions to access private and protected members of a class.
This deck provides an overview of key concepts in Objective-C including MVC architecture, classes, instances, methods, properties, delegates and protocols, Xcode IDE, and common classes and terms. It explains that MVC separates applications into modular and replaceable models, views, and controllers. Classes define properties and methods while instances contain property values. Methods are messages sent to objects. Properties use accessor methods. Header files define public interfaces while implementation files contain private code. Delegates and protocols allow communication between decoupled components.
This document discusses the history and evolution of the C# programming language. It outlines the major versions of C# since its introduction in 2002, along with the .NET Framework versions and Visual Studio releases they correspond to. Each version introduced important new features that expanded the capabilities of the language. The document provides a high-level overview of the progression of C# from its initial release to the current version.
C# programs use namespaces and classes. A class defines methods and variables. C# supports inheritance, interfaces, structs, and enums. The main method runs code. Common data types include primitive types like int and reference types like string. C# can read input, perform math operations, and conditionally execute code using if/else statements. Methods can pass parameters by value or reference.
The document discusses generics in .NET. It defines what generics are, provides examples of generic classes and methods, and explains the benefits of using generics such as type safety, performance, and code reuse. It also covers generic type parameters, constraints, and constructed generic types.
This document introduces TypeScript for Java developers. It provides an overview of TypeScript, why to use it, how to get started, and examples of key TypeScript features like classes, interfaces, generics, decorators, and async/await. The author is an Angular practice lead and Java Champion who has authored books on Angular development with TypeScript. The document demonstrates how to set up a TypeScript environment and compile code, and provides code samples for many TypeScript language features and patterns.
Framework design involves balancing many considerations, such as:
- Managing dependencies between components to allow for flexibility and evolution over time. Techniques like dependency injection and layering help achieve this.
- Designing APIs by first writing code samples for key scenarios and defining object models to support these samples to ensure usability.
- Treating simplicity as a feature by removing unnecessary requirements and reusing existing concepts where possible.
Generics allow classes and methods to work with any data type by using substitute parameters for the data types. This delays specifying the actual data type until the class or method is used. The document provides an example of a generic class MyGenericArray that can store and retrieve values of any data type. It also demonstrates a generic method Swap that can swap values of any data type and a generic delegate that handles methods with a type parameter.
The document discusses tools and techniques for making Java development more enjoyable. It recommends using libraries like Mockito, Guice and Guava to simplify testing and dependency injection. It also suggests using builder patterns, writing concise yet descriptive unit tests, and avoiding string-typing in favor of object-oriented types.
Back-2-Basics: .NET Coding Standards For The Real World (2011)David McCarter
Revamped for 2011 (90% new material), this session will guide any level of programmer to greater productivity by providing the information needed to write consistent, maintainable code. Learn about project setup, assembly layout, code style, defensive programming and much, much more. Code tips are included to help you write better, error free applications. Lots of code examples in C# and VB.NET. This session is based off my latest book, David McCarter's .NET Coding Standards.
This document provides an overview of JavaScript design patterns based on Addy Osmani's book "Essential JavaScript & jQuery Design Patterns". It begins with background on design patterns and defines what a design pattern is. It describes the structure of design patterns and discusses anti-patterns. It then covers common JavaScript design patterns including creational, structural, and behavioral patterns as well as MV* patterns like MVC, MVP, and MVVM. Specific patterns like Module, Observer, Command, Constructor & Prototype, and examples using Backbone.js, Spine.js, and Knockout.js are summarized.
This document provides an overview and introduction to the C# programming language. It begins with setting up the environment needed to code in C#, which includes Visual Studio and a Windows PC. The document then discusses basic C# syntax like data types, variables, operators, and conditional statements. It also covers arrays, strings, and encapsulation. The goal is to provide beginners with an understanding of fundamental C# concepts to get started with the language.
(7) c sharp introduction_advanvced_features_part_iiNico Ludwig
This document provides an overview of advanced C# features including collections, delegates, events, custom attributes, and reflection. It discusses how generic collections allow type-safe storage and access of elements compared to object-based collections. Delegates are described as a way to pass methods as arguments to other methods. Events allow objects to notify observers of state changes through delegate-based callbacks. Custom attributes provide a way to annotate types and members with metadata, and reflection enables examining types at runtime to access this metadata and other structural details.
This document provides an introduction to design patterns, including their motivation, history, definition, categories, and examples. Some key points:
- Design patterns solve common programming problems by describing reusable solutions that can be adapted for different situations.
- Common categories include creational, structural, and behavioral patterns. Example patterns discussed are Singleton, Decorator, Abstract Factory.
- Design patterns speed up development, promote code reuse, and make software more robust, maintainable and extensible. Resources for further information on design patterns are provided.
C# programs use the .cs file extension and consist of namespaces, classes, and methods. A basic C# program defines a Main method within a class, where code is written. Classes can inherit from other classes and implement interfaces. The document provides an overview of basic C# concepts like data types, strings, enums, structures, and passing parameters by value and reference. It also demonstrates how to get input, write output, and use common .NET classes.
This document provides an overview of programming concepts, including an introduction to programming logic, the components and purposes of programs, and different programming paradigms like structured and object-oriented programming. It discusses key object-oriented programming principles like inheritance, encapsulation, abstraction, and polymorphism. The document also briefly describes different architectural models for programs, including client-server and multi-tier architectures.
Generics allow the creation of reusable components that operate on data of unknown types. A generic class uses type parameters to specify placeholder types that are replaced by actual types when an instance is created. This allows methods, properties and events to be written that work for multiple data types. The example shows how a generic class Gen<T> can be used to store and retrieve integer and string values without needing casts. Generics provide type safety by ensuring the type of data stored matches the type expected when accessing members.
Constructors initialize objects when they are created and can be used to set initial values for object attributes. Destructors are called automatically when objects are destroyed. This document discusses various types of constructors like default, copy, parameterized constructors. It also covers constructor overloading and destructors.
Dart is a productive way to develop future JavaScript apps today. It comes with a complete set of development tools and will help ease development of EcmaScript 6 in 2016. Dart simplifies development by allowing optional variable types and single inheritance for classes. It supports concurrency without threads. Popular IDEs like IntelliJ, WebStorm, and Eclipse support Dart development. Code can run in the Dart VM for fast feedback or compile to JavaScript to run in browsers.
Domain-Specific Languages for Composable Editor Plugins (LDTA 2009)lennartkats
Modern IDEs increase developer productivity by incorporating many different kinds of editor services. These can be purely syntactic, such as syntax highlighting, code folding, and an outline for navigation; or they can be based on the language semantics, such as in-line type error reporting and resolving identifier declarations. Building all these services from scratch requires both the extensive knowledge of the sometimes complicated and highly interdependent APIs and extension mechanisms of an IDE framework, and an in-depth understanding of the structure and semantics of the targeted language. This paper describes Spoofax/IMP, a meta-tooling suite that provides high-level domain-specific languages for describing editor services, relieving editor developers from much of the framework-specific programming. Editor services are defined as composable modules of rules coupled to a modular SDF grammar. The composability provided by the SGLR parser and the declaratively defined services allows embedded languages and language extensions to be easily formulated as additional rules extending an existing language definition. The service definitions are used to generate Eclipse editor plugins. We discuss two examples: an editor plugin for WebDSL, a domain-specific language for web applications, and the embedding of WebDSL in Stratego, used for expressing the (static) semantic rules of WebDSL.
Similar to CSharp Advanced L05-Attributes+Reflection (20)
Ultra Fast, Cross Genre, Procedural Content Generation in Games [Master Thesis]Mohammad Shaker
In my MSc. thesis, I have re-tackled the problem of procedurally generating content for physics-based games I have previously investigated in my BSc. graduation thesis. This time around I propose two novel methods: the first is projection based for faster generation of physics-based games content. The other, The Progressive Generation, is a generic, wide-range, across genre, customisable with playability check method all bundled in a fast progressive approach. This new method is applied on two completely different games: NEXT And Cut the Rope.
Short, Matters, Love - Passioneers Event 2015Mohammad Shaker
Short, Matters, Love is a presentation I prepared for freshmen students at the Faculty of Information Technology in Damascus, Syria organised by Passioneers - 2015
This document discusses Unity3D and game development. It provides an overview of Unity3D and other game engines like Unreal Engine, comparing their features and costs. Examples are given of popular games made with each engine. The document also lists several games the author has made using Unity3D and provides some additional resources and references.
The document discusses various topics related to mobile application design including cloud interaction, Android touch and gesture interaction, UI element sizing, screen sizes, changing orientation, retaining objects during configuration changes, multi-device targeting, and wearables. It provides examples and guidelines for designing applications that can adapt to different devices and configurations.
The document discusses principles of interaction design, color theory, and game design. It covers topics like primary and secondary colors, color harmonies, using color to attract attention and set mood, the importance of white space and negative space in design, and how games like Journey, Fez, Luftrausers, Monument Valley, Ori and the Blind Forest, and Limbo effectively use techniques like the rule of thirds, establishing a sense of goal, and game feel.
This document discusses various topics related to typography including letter shapes like the letter "T", how words for concepts like water have evolved across languages, symbols for ideas like fish, and different writing styles such as styles that would be impossible to write. It examines typography from multiple perspectives like shapes, language evolution, symbols, and stylization.
Interaction Design L04 - Materialise and CouplingMohammad Shaker
This document discusses various aspects of coupling and interaction design in mobile applications. It addresses good and bad examples of coupling on Android and iOS, such as how apps are switched between. It also discusses using accurate text to represent backend processes, and using faster progress bars to reduce cognitive load on users. Visualizations are suggested to improve progress bars.
The document discusses various options for storing data in an Android application including SharedPreferences for simple key-value pairs, internal storage for private files, external storage for public files, SQLite databases for structured data, network connections for storing data on a web server, and ContentProviders for sharing data between applications. It provides details on using SharedPreferences, internal SQLite databases stored in the application's files, and ContentProviders for sharing Contacts data with other apps.
The document discusses various interaction design concepts in Android including toasts, notifications, threads, broadcast receivers, and alarms. It provides code examples for creating toasts, setting notification priorities, and scheduling alarms to fire at boot or at specific times using the AlarmManager. Broadcast receivers can be used to set alarms during device boot by listening for the BOOT_COMPLETED intent filter and implementing the onReceive callback.
This document provides an overview of various mobile development technologies and frameworks including Cloud, iOS, Android, iPad Pro, Xcode, Model-View-Controller (MVC), C, Objective-C, Foundation data types, functions calls, Swift, iOS Dev Center, coordinate systems, Windows Phone, .NET support, MVVM, binding, WebClient, and navigation. It also mentions tools like Expression Blend and frameworks like jQuery Mobile, PhoneGap, Sencha Touch, and Xamarin.
This document discusses various topics related to mobile app design including user experience (UX), user interface (UI), interaction design, user constraints like limited data/battery and screen size, and using context like location to improve the user experience. It provides examples of a pizza ordering app and making ATM machines smarter. It also covers design patterns and principles like focusing on user needs and testing designs through feedback.
This document discusses principles of visual organization and responsive grid systems for web design. It mentions laws of proximity, similarity, common fate, continuity, closure, and symmetry which help organize visual elements. It also discusses column-based and ratio-based grid systems as well as responsive grid systems that adapt to different screen widths, citing examples from Pinterest, Bootstrap, and the website www.mohammadshaker.com which demonstrates responsive design.
This document provides an overview comparison of key aspects of mobile app development for iOS and Android platforms. It discusses differences in app store policies, pricing, monetization options like ads and in-app purchases, development tools including engines like Unity and Unreal, and the publishing process. Key points mentioned include Android apps averaging over 2.5x the price of similar iOS apps, Apple's restrictive app review policies, the 70/30 revenue split in Google Play Store, and tools for user testing and publishing on both platforms. It also shares stats on the revenue and success of specific apps like Monument Valley.
The document discusses various ways to implement cloud functionality in Android applications using services like Parse and Android Backup. It provides code examples for backing up app data to the cloud using Android Backup, setting up a backend using Parse, pushing notifications with Parse, and performing analytics tracking with Parse.
This document discusses several topics related to developing Android apps including:
1. Adding markers to maps by setting an onMapClickListener and adding a MarkerOptions to the clicked location.
2. Signing into apps with Google accounts using the Google Identity API.
3. Following Material Design guidelines for visual style and user interfaces.
4. Maintaining multiple APK versions and using OpenGL ES for games.
This document discusses various techniques for styling Android applications including adding styles, overriding styles, using themes, custom backgrounds, nine-patch images, and animations. It provides links to tutorials and documentation on animating views with zoom animations and other motion effects.
This document provides information about various Android development topics including:
- ListAdapters and mapping models to UI using an MVVM-like pattern
- Creating custom lists
- Starting a new activity using an Intent and passing data between activities
- Understanding the Android activity lifecycle and methods like onPause() and onResume()
- Handling configuration changes that recreate the activity
- Working with permissions
The document discusses common patterns for working with lists, launching new screens, and handling activity state changes. It also provides code examples for starting a new activity, passing data between activities, and handling the activity lifecycle callbacks.
This document provides an overview of various topics related to mobile application development including cloud computing, interaction design, Android, iOS, web technologies like HTML5 and JavaScript, programming languages like Java and Objective-C, frameworks, gaming, user experience design, and more. It discusses tools for Android development and covers basics of creating an Android app like setting up the IDE, creating the UI, adding interactivity, debugging, and referencing documentation.
Flutter is a popular open source, cross-platform framework developed by Google. In this webinar we'll explore Flutter and its architecture, delve into the Flutter Embedder and Flutter’s Dart language, discover how to leverage Flutter for embedded device development, learn about Automotive Grade Linux (AGL) and its consortium and understand the rationale behind AGL's choice of Flutter for next-gen IVI systems. Don’t miss this opportunity to discover whether Flutter is right for your project.
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppGoogle
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
👉👉 Click Here To Get More Info 👇👇
https://sumonreview.com/ai-fusion-buddy-review
AI Fusion Buddy Review: Key Features
✅Create Stunning AI App Suite Fully Powered By Google's Latest AI technology, Gemini
✅Use Gemini to Build high-converting Converting Sales Video Scripts, ad copies, Trending Articles, blogs, etc.100% unique!
✅Create Ultra-HD graphics with a single keyword or phrase that commands 10x eyeballs!
✅Fully automated AI articles bulk generation!
✅Auto-post or schedule stunning AI content across all your accounts at once—WordPress, Facebook, LinkedIn, Blogger, and more.
✅With one keyword or URL, generate complete websites, landing pages, and more…
✅Automatically create & sell AI content, graphics, websites, landing pages, & all that gets you paid non-stop 24*7.
✅Pre-built High-Converting 100+ website Templates and 2000+ graphic templates logos, banners, and thumbnail images in Trending Niches.
✅Say goodbye to wasting time logging into multiple Chat GPT & AI Apps once & for all!
✅Save over $5000 per year and kick out dependency on third parties completely!
✅Brand New App: Not available anywhere else!
✅ Beginner-friendly!
✅ZERO upfront cost or any extra expenses
✅Risk-Free: 30-Day Money-Back Guarantee!
✅Commercial License included!
See My Other Reviews Article:
(1) AI Genie Review: https://sumonreview.com/ai-genie-review
(2) SocioWave Review: https://sumonreview.com/sociowave-review
(3) AI Partner & Profit Review: https://sumonreview.com/ai-partner-profit-review
(4) AI Ebook Suite Review: https://sumonreview.com/ai-ebook-suite-review
#AIFusionBuddyReview,
#AIFusionBuddyFeatures,
#AIFusionBuddyPricing,
#AIFusionBuddyProsandCons,
#AIFusionBuddyTutorial,
#AIFusionBuddyUserExperience
#AIFusionBuddyforBeginners,
#AIFusionBuddyBenefits,
#AIFusionBuddyComparison,
#AIFusionBuddyInstallation,
#AIFusionBuddyRefundPolicy,
#AIFusionBuddyDemo,
#AIFusionBuddyMaintenanceFees,
#AIFusionBuddyNewbieFriendly,
#WhatIsAIFusionBuddy?,
#HowDoesAIFusionBuddyWorks
GraphSummit Paris - The art of the possible with Graph TechnologyNeo4j
Sudhir Hasbe, Chief Product Officer, Neo4j
Join us as we explore breakthrough innovations enabled by interconnected data and AI. Discover firsthand how organizations use relationships in data to uncover contextual insights and solve our most pressing challenges – from optimizing supply chains, detecting fraud, and improving customer experiences to accelerating drug discoveries.
DDS Security Version 1.2 was adopted in 2024. This revision strengthens support for long runnings systems adding new cryptographic algorithms, certificate revocation, and hardness against DoS attacks.
Graspan: A Big Data System for Big Code AnalysisAftab Hussain
We built a disk-based parallel graph system, Graspan, that uses a novel edge-pair centric computation model to compute dynamic transitive closures on very large program graphs.
We implement context-sensitive pointer/alias and dataflow analyses on Graspan. An evaluation of these analyses on large codebases such as Linux shows that their Graspan implementations scale to millions of lines of code and are much simpler than their original implementations.
These analyses were used to augment the existing checkers; these augmented checkers found 132 new NULL pointer bugs and 1308 unnecessary NULL tests in Linux 4.4.0-rc5, PostgreSQL 8.3.9, and Apache httpd 2.2.18.
- Accepted in ASPLOS ‘17, Xi’an, China.
- Featured in the tutorial, Systemized Program Analyses: A Big Data Perspective on Static Analysis Scalability, ASPLOS ‘17.
- Invited for presentation at SoCal PLS ‘16.
- Invited for poster presentation at PLDI SRC ‘16.
OpenMetadata Community Meeting - 5th June 2024OpenMetadata
The OpenMetadata Community Meeting was held on June 5th, 2024. In this meeting, we discussed about the data quality capabilities that are integrated with the Incident Manager, providing a complete solution to handle your data observability needs. Watch the end-to-end demo of the data quality features.
* How to run your own data quality framework
* What is the performance impact of running data quality frameworks
* How to run the test cases in your own ETL pipelines
* How the Incident Manager is integrated
* Get notified with alerts when test cases fail
Watch the meeting recording here - https://www.youtube.com/watch?v=UbNOje0kf6E
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeAftab Hussain
Understanding variable roles in code has been found to be helpful by students
in learning programming -- could variable roles help deep neural models in
performing coding tasks? We do an exploratory study.
- These are slides of the talk given at InteNSE'23: The 1st International Workshop on Interpretability and Robustness in Neural Software Engineering, co-located with the 45th International Conference on Software Engineering, ICSE 2023, Melbourne Australia
Utilocate offers a comprehensive solution for locate ticket management by automating and streamlining the entire process. By integrating with Geospatial Information Systems (GIS), it provides accurate mapping and visualization of utility locations, enhancing decision-making and reducing the risk of errors. The system's advanced data analytics tools help identify trends, predict potential issues, and optimize resource allocation, making the locate ticket management process smarter and more efficient. Additionally, automated ticket management ensures consistency and reduces human error, while real-time notifications keep all relevant personnel informed and ready to respond promptly.
The system's ability to streamline workflows and automate ticket routing significantly reduces the time taken to process each ticket, making the process faster and more efficient. Mobile access allows field technicians to update ticket information on the go, ensuring that the latest information is always available and accelerating the locate process. Overall, Utilocate not only enhances the efficiency and accuracy of locate ticket management but also improves safety by minimizing the risk of utility damage through precise and timely locates.
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Crescat
Crescat is industry-trusted event management software, built by event professionals for event professionals. Founded in 2017, we have three key products tailored for the live event industry.
Crescat Event for concert promoters and event agencies. Crescat Venue for music venues, conference centers, wedding venues, concert halls and more. And Crescat Festival for festivals, conferences and complex events.
With a wide range of popular features such as event scheduling, shift management, volunteer and crew coordination, artist booking and much more, Crescat is designed for customisation and ease-of-use.
Over 125,000 events have been planned in Crescat and with hundreds of customers of all shapes and sizes, from boutique event agencies through to international concert promoters, Crescat is rigged for success. What's more, we highly value feedback from our users and we are constantly improving our software with updates, new features and improvements.
If you plan events, run a venue or produce festivals and you're looking for ways to make your life easier, then we have a solution for you. Try our software for free or schedule a no-obligation demo with one of our product specialists today at crescat.io
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsPeter Muessig
The UI5 tooling is the development and build tooling of UI5. It is built in a modular and extensible way so that it can be easily extended by your needs. This session will showcase various tooling extensions which can boost your development experience by far so that you can really work offline, transpile your code in your project to use even newer versions of EcmaScript (than 2022 which is supported right now by the UI5 tooling), consume any npm package of your choice in your project, using different kind of proxies, and even stitching UI5 projects during development together to mimic your target environment.
Revolutionizing Visual Effects Mastering AI Face Swaps.pdfUndress Baby
The quest for the best AI face swap solution is marked by an amalgamation of technological prowess and artistic finesse, where cutting-edge algorithms seamlessly replace faces in images or videos with striking realism. Leveraging advanced deep learning techniques, the best AI face swap tools meticulously analyze facial features, lighting conditions, and expressions to execute flawless transformations, ensuring natural-looking results that blur the line between reality and illusion, captivating users with their ingenuity and sophistication.
Web:- https://undressbaby.com/
Essentials of Automations: The Art of Triggers and Actions in FMESafe Software
In this second installment of our Essentials of Automations webinar series, we’ll explore the landscape of triggers and actions, guiding you through the nuances of authoring and adapting workspaces for seamless automations. Gain an understanding of the full spectrum of triggers and actions available in FME, empowering you to enhance your workspaces for efficient automation.
We’ll kick things off by showcasing the most commonly used event-based triggers, introducing you to various automation workflows like manual triggers, schedules, directory watchers, and more. Plus, see how these elements play out in real scenarios.
Whether you’re tweaking your current setup or building from the ground up, this session will arm you with the tools and insights needed to transform your FME usage into a powerhouse of productivity. Join us to discover effective strategies that simplify complex processes, enhancing your productivity and transforming your data management practices with FME. Let’s turn complexity into clarity and make your workspaces work wonders!
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...kalichargn70th171
A dynamic process unfolds in the intricate realm of software development, dedicated to crafting and sustaining products that effortlessly address user needs. Amidst vital stages like market analysis and requirement assessments, the heart of software development lies in the meticulous creation and upkeep of source code. Code alterations are inherent, challenging code quality, particularly under stringent deadlines.
E-commerce Application Development Company.pdfHornet Dynamics
Your business can reach new heights with our assistance as we design solutions that are specifically appropriate for your goals and vision. Our eCommerce application solutions can digitally coordinate all retail operations processes to meet the demands of the marketplace while maintaining business continuity.
Atelier - Innover avec l’IA Générative et les graphes de connaissancesNeo4j
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Allez au-delà du battage médiatique autour de l’IA et découvrez des techniques pratiques pour utiliser l’IA de manière responsable à travers les données de votre organisation. Explorez comment utiliser les graphes de connaissances pour augmenter la précision, la transparence et la capacité d’explication dans les systèmes d’IA générative. Vous partirez avec une expérience pratique combinant les relations entre les données et les LLM pour apporter du contexte spécifique à votre domaine et améliorer votre raisonnement.
Amenez votre ordinateur portable et nous vous guiderons sur la mise en place de votre propre pile d’IA générative, en vous fournissant des exemples pratiques et codés pour démarrer en quelques minutes.
Odoo ERP software
Odoo ERP software, a leading open-source software for Enterprise Resource Planning (ERP) and business management, has recently launched its latest version, Odoo 17 Community Edition. This update introduces a range of new features and enhancements designed to streamline business operations and support growth.
The Odoo Community serves as a cost-free edition within the Odoo suite of ERP systems. Tailored to accommodate the standard needs of business operations, it provides a robust platform suitable for organisations of different sizes and business sectors. Within the Odoo Community Edition, users can access a variety of essential features and services essential for managing day-to-day tasks efficiently.
This blog presents a detailed overview of the features available within the Odoo 17 Community edition, and the differences between Odoo 17 community and enterprise editions, aiming to equip you with the necessary information to make an informed decision about its suitability for your business.
What is Augmented Reality Image Trackingpavan998932
Augmented Reality (AR) Image Tracking is a technology that enables AR applications to recognize and track images in the real world, overlaying digital content onto them. This enhances the user's interaction with their environment by providing additional information and interactive elements directly tied to physical images.
Takashi Kobayashi and Hironori Washizaki, "SWEBOK Guide and Future of SE Education," First International Symposium on the Future of Software Engineering (FUSE), June 3-6, 2024, Okinawa, Japan
3. AttributesMuch of the C# language enables the programmer to specify declarative information about the entities defined in the program. For example, the accessibility of a method in a class is specified by decorating it with the method-modifiers public, protected, internal, and private. C# enables programmers to invent new kinds of declarative information, called attributes. Programmers can then attach attributes to various program entities, and retrieve attribute information in a run-time environment. For instance, a framework might define a HelpAttributeattribute that can be placed on certain program elements (such as classes and methods) to provide a mapping from those program elements to their documentation. (from MSDN)
5. "DLL Hell“ problem
•can be caused by one application overwritinga sharedlibrary of another application, usually with a different version.
•Imagine you write an application with a shared library and then years later create a new application with an updated library.
•In order not to break old programs, what do you do with the new library? You give it a different name, store it in a different location, or overwrite the old ones?
6. "DLL Hell“ problem
•can be caused by one application overwritinga sharedlibrary of another application, usually with a different version.
•Imagine you write an application with a shared library and then years later create a new application with an updated library.
•In order not to break old programs, what do you do with the new library? You give it a different name, store it in a different location, or overwrite the old ones?
8. Assemblies
•What’s an assembly?
–An assembly is a file that is automatically generated by the compiler upon successful compilation of every.NET application. It can be either a Dynamic Link Library or an executable file. It is generated only once for an application and upon each subsequent compilation the assembly gets updated.
–contains the intermediate code, resources, and the metadata for itself.
–We can have a look inside the assembly using the ildasm(Intermediate Language Disassembler) tool that comes as part of Visual Studio.
–To access it you need to open the Visual Studio Command Prompt and type ildasm.exe. This will launch a Windows application that you can use to explore any.Netapplication.
9. Attributes and Reflection
•Attributes
–Attributes provide a powerful method of associating declarative information with C# code (types, methods, properties, and so forth).
–Once associated with a program entity, the attribute can be queried at run time and used in any number of ways.
10. Attributes and Reflection
•Example usage of attributes includes:
–Associating help documentation with program entities (through aHelpattribute).
–Associating value editors to a specific type in a GUI framework (through aValueEditorattribute).
13. Example at the start
enumCarColour
{
[Description("Ice Cream White")]
White,
[Description("Carbon Black")]
Black,
[Description("Sterling Silver")]
Silver,
Red
}
14. Example at the start
enumCarColour
{
[Description("Ice Cream White")]
White,
[Description("Carbon Black")]
Black,
[Description("Sterling Silver")]
Silver,
Red
}
Attributes
15. Example at the start
public static class EnumExtensions
{
public static string Description(this EnumenumValue)
{
varenumType= enumValue.GetType();
varfield = enumType.GetField(enumValue.ToString());
varattributes = field.GetCustomAttributes(typeof(DescriptionAttribute), false);
return ((DescriptionAttribute)attributes[0]).Description;
}
}
enumCarColour
{
[Description("Ice Cream White")]
White,
[Description("Carbon Black")]
Black,
[Description("Sterling Silver")]
Silver,
Red
}
16. Example at the start
public static class EnumExtensions
{
public static string Description(this EnumenumValue)
{
varenumType= enumValue.GetType();
varfield = enumType.GetField(enumValue.ToString());
varattributes = field.GetCustomAttributes(typeof(DescriptionAttribute), false);
return ((DescriptionAttribute)attributes[0]).Description;
}
}
enumCarColour
{
[Description("Ice Cream White")]
White,
[Description("Carbon Black")]
Black,
[Description("Sterling Silver")]
Silver,
Red
}
Extension Method
17. Example at the start
public static class EnumExtensions
{
public static string Description(this EnumenumValue)
{
varenumType= enumValue.GetType();
varfield = enumType.GetField(enumValue.ToString());
varattributes = field.GetCustomAttributes(typeof(DescriptionAttribute), false);
return ((DescriptionAttribute)attributes[0]).Description;
}
}
enumCarColour
{
[Description("Ice Cream White")]
White,
[Description("Carbon Black")]
Black,
[Description("Sterling Silver")]
Silver,
Red
}
Reflection
18. Example at the start
public static class EnumExtensions
{
public static string Description(this EnumenumValue)
{
varenumType= enumValue.GetType();
varfield = enumType.GetField(enumValue.ToString());
varattributes = field.GetCustomAttributes(typeof(DescriptionAttribute), false);
return ((DescriptionAttribute)attributes[0]).Description;
}
}
enumCarColour
{
[Description("Ice Cream White")]
White,
[Description("Carbon Black")]
Black,
[Description("Sterling Silver")]
Silver,
Red
}
19. Example at the start
public static class EnumExtensions
{
public static string Description(this EnumenumValue)
{
varenumType= enumValue.GetType();
varfield = enumType.GetField(enumValue.ToString());
varattributes = field.GetCustomAttributes(typeof(DescriptionAttribute), false);
return ((DescriptionAttribute)attributes[0]).Description;
}
}
enumCarColour
{
[Description("Ice Cream White")]
White,
[Description("Carbon Black")]
Black,
[Description("Sterling Silver")]
Silver,
Red
}
20. Example at the start
public static class EnumExtensions
{
public static string Description(this EnumenumValue)
{
varenumType= enumValue.GetType();
varfield = enumType.GetField(enumValue.ToString());
varattributes = field.GetCustomAttributes(typeof(DescriptionAttribute), false);
return ((DescriptionAttribute)attributes[0]).Description;
}
}
for (CarColourcc = CarColour.White; cc <= CarColour.Red; cc++)
{
Console.WriteLine(cc.Description());
}
enumCarColour
{
[Description("Ice Cream White")]
White,
[Description("Carbon Black")]
Black,
[Description("Sterling Silver")]
Silver,
Red
}
21. Example at the start
public static class EnumExtensions
{
public static string Description(this EnumenumValue)
{
varenumType= enumValue.GetType();
varfield = enumType.GetField(enumValue.ToString());
varattributes = field.GetCustomAttributes(typeof(DescriptionAttribute), false);
return ((DescriptionAttribute)attributes[0]).Description;
}
}
for (CarColourcc = CarColour.White; cc <= CarColour.Red; cc++)
{
Console.WriteLine(cc.Description());
}
enumCarColour
{
[Description("Ice Cream White")]
White,
[Description("Carbon Black")]
Black,
[Description("Sterling Silver")]
Silver,
Red
}
Ice Cream White
Carbon Black
Sterling Silver
Red
23. Attributes Basics
•Attributes are generally applied physically in front of type and type member declarations. They're declared with square brackets, "[" and "]", surrounding the attribute such as the followingObsoleteAttributeattribute:
•[ObsoleteAttribute]
AttributeUsage
Describes how a custom attribute class can be used.
Conditional
Marks a conditional method, a method whose execution depends on a specified preprocessing identifier.
Obsolete
Marks a program entity that should not be used.
29. Pre-Defined Attributes
// make the program thread safe for COM[STAThread] staticvoidMain(string[] args) { BasicAttributeDemoattrDemo=newBasicAttributeDemo(); attrDemo.MyFirstdeprecatedMethod(); attrDemo.MySecondDeprecatedMethod(); attrDemo.MyThirdDeprecatedMethod(); } }
30. Pre-Defined Attributes
// make the program thread safe for COM[STAThread] staticvoidMain(string[] args) { BasicAttributeDemoattrDemo=newBasicAttributeDemo(); attrDemo.MyFirstdeprecatedMethod(); attrDemo.MySecondDeprecatedMethod(); attrDemo.MyThirdDeprecatedMethod(); } }
37. Conditional Methodsallow developers to create methods whose calls can be placed in the code and then either included or omitted during compilation based on a preprocessing symbol.
38. Conditional Methods
•TheConditional attribute takes one parameter —the preprocessing identifier that controls whether the method call is included when clients are compiled. If the preprocessing identifier is defined, the method is called; otherwise, the call is never inserted in the client's code.
using System;
using System.Diagnostics;
namespace TraceFunctions
{
public class Trace
{
[Conditional("DEBUG")]
public static void Message(string traceMessage)
{
Console.WriteLine("[TRACE] -" + traceMessage);
}
}
}
45. Types and Reflection
•Reflection
–Provides objects (of typeType) that encapsulate assemblies, modules and types.
–You can use reflection to dynamically create an instance of a type, bind the type to an existing object, or get the type from an existing object and invoke its methods or access its fields and properties.
–If you are using attributes in your code, Reflection enables you to access them.
46. Types and Reflection
•Reflection is useful in the following situations:
–When you need to access attributes in your program's metadata.
•“Accessing Attributes With Reflection”
–For examining and instantiating types in an assembly.
–For building new types at runtime. Use classes inSystem.Reflection.Emit
–For performing late binding, accessing methods on types created at run time.
47. Types and Reflection
•Reflection is useful in the following situations:
–When you need to access attributes in your program's metadata.
•“Accessing Attributes With Reflection”
–For examining and instantiating types in an assembly.
–For building new types at runtime. Use classes inSystem.Reflection.Emit
–For performing late binding, accessing methods on types created at run time.
49. System.Typeclass
•TheSystem.Typeclass is central to reflection.
•The common language runtime creates theTypefor a loaded type when reflection requests it. You can use aTypeobject's methods, fields, properties, and nested classes to find out everything about that type.
50. System.Typeclass
•Simple example of Reflection using the static methodGetType-inherited by all types from theObjectbase class -to obtain the type of a variable:
// Using GetTypeto obtain type information:
inti=42;
System.Typetype=i.GetType();
System.Console.WriteLine(type);
51. System.Typeclass
•Simple example of Reflection using the static methodGetType-inherited by all types from theObjectbase class -to obtain the type of a variable:
// Using GetTypeto obtain type information:
inti=42;
System.Typetype=i.GetType();
System.Console.WriteLine(type);
System.Int32
52. Types and Reflection
•Identifying all Types that Implement an Interface (http://www.blackwasp.co.uk/)
public interface IParent{ }
public class Parent { }
public class Child1 : Parent { }
public class Child2 : Parent { }
public class Grandchild11 : Child1 { }
public class Grandchild12 : Child1 { }
public class Grandchild21 : Child2 { }
public class Grandchild22 : Child2 { }
public class NotAChild{ }
public class NotAGrandchild: NotAChild{ }
Type parentType= typeof(IParent);
Assembly assembly= Assembly.GetExecutingAssembly();
Type[] types = assembly.GetTypes();
53. Types and Reflection
•Identifying all Types that Implement an Interface
public interface IParent{ }
public class Parent { }
public class Child1 : Parent { }
public class Child2 : Parent { }
public class Grandchild11 : Child1 { }
public class Grandchild12 : Child1 { }
public class Grandchild21 : Child2 { }
public class Grandchild22 : Child2 { }
public class NotAChild{ }
public class NotAGrandchild: NotAChild{ }
IEnumerable<Type> imp = types.Where(t => t.GetInterfaces().Contains(interfaceType));
foreach(Type typein imp)
{
Console.WriteLine(type.Name);
}
/* OUTPUT
Parent
Child1
Child2
Grandchild11
Grandchild12
Grandchild21
Grandchild22
*/
Type parentType= typeof(IParent);
Assembly assembly= Assembly.GetExecutingAssembly();
Type[] types = assembly.GetTypes();
54. Types and Reflection
•Identifying all Subclasses of a Class (http://www.blackwasp.co.uk/)
public interface IParent{ }
public class Parent { }
public class Child1 : Parent { }
public class Child2 : Parent { }
public class Grandchild11 : Child1 { }
public class Grandchild12 : Child1 { }
public class Grandchild21 : Child2 { }
public class Grandchild22 : Child2 { }
public class NotAChild{ }
public class NotAGrandchild: NotAChild{ }
Type parentType= typeof(IParent);
Assembly assembly= Assembly.GetExecutingAssembly();
Type[] types = assembly.GetTypes();
55. Types and Reflection
•Identifying all Subclasses of a Class
public interface IParent{ }
public class Parent { }
public class Child1 : Parent { }
public class Child2 : Parent { }
public class Grandchild11 : Child1 { }
public class Grandchild12 : Child1 { }
public class Grandchild21 : Child2 { }
public class Grandchild22 : Child2 { }
public class NotAChild{ }
public class NotAGrandchild: NotAChild{ }
IEnumerable<Type> subclasses = types.Where(t => t.IsSubclassOf(parentType));
foreach(Type typein subclasses)
{
Console.WriteLine(type.Name);
}
/* OUTPUT
Child1
Child2
Grandchild11
Grandchild12
Grandchild21
Grandchild22
*/
Type parentType= typeof(IParent);
Assembly assembly= Assembly.GetExecutingAssembly();
Type[] types = assembly.GetTypes();
57. Types and Reflection
// This program lists all the public constructors
// of the System.Stringclass.
usingSystem;
usingSystem.Reflection;
classListMembers
{
publicstaticvoidMain(String[] args)
{
Typet=typeof(System.String);
Console.WriteLine("Listing all the public constructors of the {0} type", t);
// Constructors.
ConstructorInfo[] ci=t.GetConstructors(BindingFlags.Public|BindingFlags.Instance);
Console.WriteLine("//Constructors");
PrintMembers(ci);
}
publicstaticvoidPrintMembers(MemberInfo[] ms)
{
foreach(MemberInfominms)
{
Console.WriteLine("{0}{1}", " ", m);
}
Console.WriteLine();
}
}
58. Types and Reflection
// This program lists all the public constructors
// of the System.Stringclass.
usingSystem;
usingSystem.Reflection;
classListMembers
{
publicstaticvoidMain(String[] args)
{
Typet=typeof(System.String);
Console.WriteLine("Listing all the public constructors of the {0} type", t);
// Constructors.
ConstructorInfo[] ci=t.GetConstructors(BindingFlags.Public|BindingFlags.Instance);
Console.WriteLine("//Constructors");
PrintMembers(ci);
}
publicstaticvoidPrintMembers(MemberInfo[] ms)
{
foreach(MemberInfominms)
{
Console.WriteLine("{0}{1}", " ", m);
}
Console.WriteLine();
}
}
Listing all the public constructors of the System.Stringtype
//Constructors
Void.ctor(Char*)
Void.ctor(Char*, Int32, Int32)
Void.ctor(SByte*)
Void.ctor(SByte*, Int32, Int32)
Void.ctor(SByte*, Int32, Int32, System.Text.Encoding)
Void.ctor(Char[], Int32, Int32)
Void.ctor(Char[])
Void.ctor(Char, Int32)
Press any key to continue...
60. Invoking Overloaded Methods Using Reflection
public class Test
{
public void ShowMessage()
{
Console.WriteLine("Hello, world");
}
public void ShowMessage(string msg, inttimesToShow)
{
for (inti= 0; i< timesToShow; i++)
{
Console.WriteLine(msg);
}
}
}
61. Invoking Overloaded Methods Using Reflection
public class Test
{
public void ShowMessage()
{
Console.WriteLine("Hello, world");
}
public void ShowMessage(string msg, inttimesToShow)
{
for (inti= 0; i< timesToShow; i++)
{
Console.WriteLine(msg);
}
}
}
Test test= new Test();
Type type= test.GetType();
MethodInfomethod = type.GetMethod("ShowMessage", new Type[] { typeof(string), typeof(int) });
method.Invoke(test, new object[] { "Exterminate!", 3 });
62. Invoking Overloaded Methods Using Reflection
public class Test
{
public void ShowMessage()
{
Console.WriteLine("Hello, world");
}
public void ShowMessage(string msg, inttimesToShow)
{
for (inti= 0; i< timesToShow; i++)
{
Console.WriteLine(msg);
}
}
}
Test test= new Test();
Type type= test.GetType();
MethodInfomethod = type.GetMethod("ShowMessage", new Type[] { typeof(string), typeof(int) });
method.Invoke(test, new object[] { "Exterminate!", 3 });
63. Invoking Overloaded Methods Using Reflection
public class Test
{
public void ShowMessage()
{
Console.WriteLine("Hello, world");
}
public void ShowMessage(string msg, inttimesToShow)
{
for (inti= 0; i< timesToShow; i++)
{
Console.WriteLine(msg);
}
}
}
Test test= new Test();
Type type= test.GetType();
MethodInfomethod = type.GetMethod("ShowMessage", new Type[] { typeof(string), typeof(int) });
method.Invoke(test, new object[] { "Exterminate!", 3 });
Exterminate!
Exterminate!
Exterminate!
68. Accessing Attributes Through Reflection
•Let’s have the following giantexample!
publicclassIsTestedAttribute: Attribute
{
publicoverridestringToString()
{
return"Is Tested";
}
}
69. Concept of Attributes
[AttributeUsage(AttributeTargets.Class|AttributeTargets.Struct)]
publicclassAuthorAttribute: Attribute
{
publicAuthorAttribute(stringname)
{
this.name=name;
this.version=0;
}
publicstringName
{ get
{
returnname;
}
}
publicintVersion
{
get
{
returnversion;
}
set
{
version=value;
}
}
publicoverridestringToString()
{
stringvalue="Author : "+Name;
if(version!=0)
{
value+=" Version : "+Version.ToString();
}
returnvalue;
}
privatestringname;
privateintversion;
}
70. Concept of Attributes
[AttributeUsage(AttributeTargets.Class|AttributeTargets.Struct)]
publicclassAuthorAttribute: Attribute
{
publicAuthorAttribute(stringname)
{
this.name=name;
this.version=0;
}
publicstringName
{ get
{
returnname;
}
}
publicintVersion
{
get
{
returnversion;
}
set
{
version=value;
}
}
publicoverridestringToString()
{
stringvalue="Author : "+Name;
if(version!=0)
{
value+=" Version : "+Version.ToString();
}
returnvalue;
}
privatestringname;
privateintversion;
}
71. Concept of Attributes
[AttributeUsage(AttributeTargets.Class|AttributeTargets.Struct)]
publicclassAuthorAttribute: Attribute
{
publicAuthorAttribute(stringname)
{
this.name=name;
this.version=0;
}
publicstringName
{ get
{
returnname;
}
}
publicintVersion
{
get
{
returnversion;
}
set
{
version=value;
}
}
publicoverridestringToString()
{
stringvalue="Author : "+Name;
if(version!=0)
{
value+=" Version : "+Version.ToString();
}
returnvalue;
}
privatestringname;
privateintversion;
}
72. Concept of Attributes
[AttributeUsage(AttributeTargets.Class|AttributeTargets.Struct)]
publicclassAuthorAttribute: Attribute
{
publicAuthorAttribute(stringname)
{
this.name=name;
this.version=0;
}
publicstringName
{ get
{
returnname;
}
}
publicintVersion
{
get
{
returnversion;
}
set
{
version=value;
}
}
publicoverridestringToString()
{
stringvalue="Author : "+Name;
if(version!=0)
{
value+=" Version : "+Version.ToString();
}
returnvalue;
}
privatestringname;
privateintversion;
}
73. Accessing Attributes Through Reflection
[Author("Joe Programmer")]
classAccount
{
// Attach the IsTestedAttributecustom attribute to this method.
[IsTested]
publicvoidAddOrder(OrderorderToAdd)
{
orders.Add(orderToAdd);
}
privateArrayListorders=newArrayList();
}
[Author("Jane Programmer", Version=2), IsTested()]
classOrder
{
// add stuff here...
}
74. Accessing Attributes Through Reflection
[Author("Joe Programmer")]
classAccount
{
// Attach the IsTestedAttributecustom attribute to this method.
[IsTested]
publicvoidAddOrder(OrderorderToAdd)
{
orders.Add(orderToAdd);
}
privateArrayListorders=newArrayList();
}
[Author("Jane Programmer", Version=2), IsTested()]
classOrder
{
// add stuff here...
}
75. Accessing Attributes Through Reflection
[Author("Joe Programmer")]
classAccount
{
// Attach the IsTestedAttributecustom attribute to this method.
[IsTested]
publicvoidAddOrder(OrderorderToAdd)
{
orders.Add(orderToAdd);
}
privateArrayListorders=newArrayList();
}
[Author("Jane Programmer", Version=2), IsTested()]
classOrder
{
// add stuff here...
}
77. Concept of Attributes
publicstaticvoidmain()
{ DumpAttributes(typeof(Account));
foreach(MethodInfomethodin(typeof(Account)).GetMethods())
{
if(IsMemberTested(method))
{
Console.WriteLine("Member {0} is tested!", method.Name);
}
else
{
Console.WriteLine("Member {0} is NOT tested!", method.Name);
}
}
Console.WriteLine();
// display attributes for Order class
DumpAttributes(typeof(Order));
// display attributes for methods on the Order class
foreach(MethodInfomethodin(typeof(Order)).GetMethods())
{
if(IsMemberTested(method))
{
Console.WriteLine("Member {0} is tested!", method.Name);
}
else
{
Console.WriteLine("Member {0} is NOT tested!", method.Name);
}
}
Console.WriteLine(); } }
78. Concept of Attributes
publicstaticvoidmain()
{ DumpAttributes(typeof(Account));
foreach(MethodInfomethodin(typeof(Account)).GetMethods())
{
if(IsMemberTested(method))
{
Console.WriteLine("Member {0} is tested!", method.Name);
}
else
{
Console.WriteLine("Member {0} is NOT tested!", method.Name);
}
}
Console.WriteLine();
// display attributes for Order class
DumpAttributes(typeof(Order));
// display attributes for methods on the Order class
foreach(MethodInfomethodin(typeof(Order)).GetMethods())
{
if(IsMemberTested(method))
{
Console.WriteLine("Member {0} is tested!", method.Name);
}
else
{
Console.WriteLine("Member {0} is NOT tested!", method.Name);
}
}
Console.WriteLine(); } }
79. Concept of Attributes
publicstaticvoidmain()
{ DumpAttributes(typeof(Account));
foreach(MethodInfomethod in (typeof(Account)).GetMethods())
{
if (IsMemberTested(method))
{
Console.WriteLine("Member {0} is tested!", method.Name);
}
else
{
Console.WriteLine("Member {0} is NOT tested!", method.Name);
}
}
Console.WriteLine();
// display attributes for Order class
DumpAttributes(typeof(Order));
// display attributes for methods on the Order class
foreach(MethodInfomethod in (typeof(Order)).GetMethods())
{
if (IsMemberTested(method))
{
Console.WriteLine("Member {0} is tested!", method.Name);
}
else
{
Console.WriteLine("Member {0} is NOT tested!", method.Name);
}
}
Console.WriteLine(); } }
80. Accessing Attributes Through Reflection
Attributes for : Account
Author : Joe Programmer
Member AddOrderis tested!
Member ToStringis NOT tested!
Member Equals is NOT tested!
Member GetHashCodeis NOT tested!
Member GetTypeis NOT tested!
Attributes for : Order
Author : Jane Programmer Version : 2
Is Tested
Member ToStringis NOT tested!
Member Equals is NOT tested!
Member GetHashCodeis NOT tested!
Member GetTypeis NOT tested!
Press any key to continue...