background preloader

C#

Facebook Twitter

Cocos2d. Writing interfaces that can be implemented by both Native and Managed classes. This article explains how to specify an interface that can be implemented by native and managed classes on Window Phone 8.

Writing interfaces that can be implemented by both Native and Managed classes

The interface is then used in an Inversion of Control pattern (IoC). Introduction Interfaces are fundamental in object-oriented systems. An interface is a contract, that specifies the complete set of requests that can be sent to an object, typically its methods, properties and fields. On Windows Phone 8, it is very easy to define interfaces in managed code (C#, Visual Basic), and on the native side (C++), an interface is defined using abstract classes. Local database for Windows Phone. Selecting data (database queries) On Windows Phone, Language Integrated Query (LINQ) is used to query the database.

Local database for Windows Phone

LINQ bridges the gap between the world of objects and the world of data. Queries in LINQ to SQL use the same syntax as queries in LINQ. For more information about LINQ queries, see Introduction to LINQ Queries (C#). Because objects referenced in LINQ to SQL queries are mapped to records in a database, LINQ to SQL differs from other LINQ technologies in the way that queries are executed.

In the following example, a DataContext object named toDoDB is queried with LINQ to SQL and the results are placed into an ObservableCollection of ToDoItem objects named ToDoItems. Working with SQLite in Windows Phone 8: a sqlite-net version for mobile. With a perfect timing, as soon as I’ve published my previous post about using the chsarp-sqlite engine in combination with sqlite-net, Peter Huene has released a porting of the famous library for Windows Phone 8.

Working with SQLite in Windows Phone 8: a sqlite-net version for mobile

What does it mean? That, finally, we are able to use the native SQLite engine that has been released as a Visual Studio extension and that we can use a common library to share our data layer with a Windows Store app for Windows 8. At the moment, the project isn’t available on NuGet yet and requires two steps: the first one is to add a native class, that acts as a wrapper for the functions used by sqlite-net, and the second is to download a specific sqlite-net version, where the developer has replaced the usage of the csharp-sqlite engine with the native one.

Let’s start! Please welcome GitHub. How to use SQLite in Windows Phone. This article explains how to add SQLite support in Windows Phone 8 applications and how to start using it.

How to use SQLite in Windows Phone

Introduction A very common task for most of the applications is to store and access the data. Almost all applications has to store some kind of user data for a later use. This is the reason why mobile platforms provide ways to the developer handle those data; with Windows Phone 8 is not different, it provides the System.IO.IsolatedStorage namespace to access files and/or application settings. This is normally enough for many applications, but a database would be better if the user wants to store data in a more structured way.

Windows Phone Using Sqlite with WP8 sample in C#, VB.NET, C++, XAML for Visual Studio 2012. TCP/IP Socket-Programmierung in C# Seite 1 von 7 Einführung Als Ende der 1960er-Jahre die Vorgängerversion des heute bekannten Internets entstand, nämlich das ARPAnet, konnten sich die damals beteiligten Personen den Einfluss eines derartigen dezentralen Computernetzwerkes noch gar nicht vorstellen.

TCP/IP Socket-Programmierung in C#

Kein Wunder, diente es anfangs doch nur einigen amerikanischen Universitäten zu Forschungszwecken um ihre Computer zu vernetzen und so die Rechenzeit besser ausnutzen zu können. Configuring TCP/IP Settings using WMI and C# Download source - 5 Kb Introduction This article demonstrates the power of WMI, on how to configure TCP/IP Setting programmatically using C#. This article is targeted at intermediate developers. Using the code WMI Extends the possibilities of .NET and simplifies the life while working on NetworkAdapters. Now, here is the code to configure TCP/IP Settings using WMI. There are some interesting methods in the Win32_NetworkAdapterConfiguration WMI Class, which represents the behaviour and attributes of a NetworkAdapter, explore them at. WPF Tutorial - Fun With Markup Extensions. Markup extensions!

WPF Tutorial - Fun With Markup Extensions

A very important aspect of XAML - but while you are using them all the time, you probably pay very little attention to the fact that they are markup extensions. Every time you are using those curly braces in XAML, you are dealing with a markup extension. Probably the most common one is StaticResource, but Binding is probably up there too. But so what? So Microsoft came up with a funny syntax for enabling programmers to set complicated values on XML attributes easily. Design Pattern Katalog. Studienprojekt von Philipp Hauer. 2009 - 2010.

Design Pattern Katalog

Das State Design Pattern (Zustand Entwurfsmuster) Das Command Design Pattern (Befehl Entwurfsmuster) .NET Design Patterns in C# and VB.NET - Gang of Four (GOF) - DoFactory. Design patterns are solutions to software design problems you find again and again in real-world application development.

.NET Design Patterns in C# and VB.NET - Gang of Four (GOF) - DoFactory

Patterns are about reusable designs and interactions of objects. The 23 Gang of Four (GoF) patterns are generally considered the foundation for all other patterns. They are categorized in three groups: Creational, Structural, and Behavioral (for a complete list see below). State Design Pattern in C# and VB.NET. Command Design Pattern in C# and VB.NET. Using System; using System.Collections.Generic; Simple state machine example in C# Simple-state-machine-example-in-C# gesucht. StateMachine-Klasse (System.Activities.Statements) [ContentPropertyAttribute("States")] public sealed class StateMachine : NativeActivity.

StateMachine-Klasse (System.Activities.Statements)

Tutorial: Common Design Patterns in C# 4.0. .NET Design Patterns in C# and VB.NET - Gang of Four (GOF) - DoFactory. THE MODEL-VIEW-VIEWMODEL (MVVM) DESIGN PATTERN FOR WPF. Patterns WPF Apps With The Model-View-ViewModel Design Pattern Josh Smith Developing the user interface of a professional software application is not easy.

THE MODEL-VIEW-VIEWMODEL (MVVM) DESIGN PATTERN FOR WPF

It can be a murky blend of data, interaction design, visual design, connectivity, multithreading, security, internationalization, validation, unit testing, and a touch of voodoo. Considering that a user interface exposes the underlying system and must satisfy the unpredictable stylistic requirements of its users, it can be the most volatile area of many applications. There are popular design patterns that can help to tame this unwieldy beast, but properly separating and addressing the multitude of concerns can be difficult. On developing Pochet.NET» Blog Archive » INotifyPropertyChanged implementations: An Overview. Summary One of the cornerstones of MVVM is the INotifyPropertyChanged interface. This post describes several implementations that have been used/proposed over time. Table of contents Introduction The basic ingredient of each INotifyPropertyChanged implementation is the declaration of the PropertyChanged event, and a function to raise this event. Public class BindableObject { public event PropertyChangedEventHandler PropertyChanged; protected void OnPropertyChanged(string propertyName) { PropertyChangedEventHandler handler = this.PropertyChanged; if (handler == null || String.IsNullOrWhiteSpace(propertyName)) { return; } handler(this, new PropertyChangedEventArgs(propertyName)); }}

[Sofa GmbH] CADability dotNET: CAD Tool and Know How for Programming. Import, Analyse and Modify an existing drawing. Ï»¿ CADability dotNET Here you find code examples for using CADability. Import, Analyse and Modify an existing drawing: Find all drill holes of a solid. Measuring Execution Time in C# by ger. Motivation Sometimes, while writing programs, we can get into situations when we need to measure execution times of various tasks.

Each programming language provides some mechanism to retrieve the current time from the system. If we read and store the system time at various moments, we can compute time intervals by substracting the values of system time taken at diffent moments. Saving Data. Designing Efficient Software. This article describes and benchmarks different ways to do file I/O from C#. All of the code referenced in this article is available for download and is free to use. There are many different ways to do file I/O in C#. The .NET framework provides the following classes: File – Provides static methods for the creation, opening of files, copying, deleting, moving, reading, and writing of files.BinaryReader – Reads primitive data types as binary values using a specific encoding.BinaryWriter – Writes primitive types in binary to a stream and supports writing strings using a specific encoding.StreamReader – Implements a TextReader that reads characters from a byte stream using a particular encoding.StreamWriter – Implements a TextWriter for writing characters to a stream using a particular encoding.FileStream – Exposes a Stream around a file, supporting both synchronous and asynchronous read and write operations.

Writing simple custom formatter - implementation of IFormatter intereface. While writing practice programs for my 70-536 exam I encountered interesting problem of writing custom IFormatter implementation. .NET offers many classes that can fit most of ours serialization tasks, yet sometimes it might happen that we would like to do something differently. As I was looking for sample implementation of this interface, I noticed that there was very little about it in internet. One of the most interesting articles was "Run-time Serialization" by Jeffrey Richter found in april 2002 MSDN Magazine ( It does not talk much about custom IFormatter implementetion but gives good explanation of FormatterServices class - which is very useful for this task. Below is simple example of how to implement custom formatter class, its purpose is to serialize any class's fields to well known ini file format. System.IO Namespace () IFormatter Interface (System.Runtime.Serialization)

Provides functionality for formatting serialized objects. [ComVisibleAttribute(true)] public interface IFormatter The IFormatter type exposes the following members. Notes to Implementers. ISerializable Interface (System.Runtime.Serialization) Version Tolerant Serialization. In version 1.0 and 1.1 of the .NET Framework, creating serializable types that would be reusable from one version of an application to the next was problematic. If a type was modified by adding extra fields, the following problems would occur: Older versions of an application would throw exceptions when asked to deserialize new versions of the old type. Serialization - C# best practice when serializing objects to file. Serialization - Saving Data Structures in C# MemoryStream Class (System.IO) Memory streams created with an unsigned byte array provide a non-resizable stream of the data. When using a byte array, you can neither append to nor shrink the stream, although you might be able to modify the existing contents depending on the parameters passed into the constructor.

Empty memory streams are resizable, and can be written to and read from. XmlSerializer. Successful Formatting In .NET Framework Versions 1.1 and 2.0. New information has been added to this article since publication. Performance - how to write super fast file streaming code in C# CVS - StreamReader. .net - C# Whats the Fastest Way to Read a File One Line at a Time. SQLite. SQLite C# tutorial. C# und SQLite – Eine kleine Einführung » Thomas Belsers Homepage. How can I install a font from the command line/batch file? Read, write and delete from registry with C# Visual C# Category. How to change IP Address of local system using c# Win32_NetworkAdapterConfiguration class.

Modify ConnectionString in App.Config. Threading in C# - Free E-book.

ASP.NET