background preloader

C#

Facebook Twitter

C# Forum: C#, ASP.NET Forum, VB.NET, WCF, WPF, Silverlight, WF, Silverlight. Feature Tour - Matt Ward. SharpDevelop @ic#code. C# - Excel: DataTable mittels OLEDB in Excel-Dokument exportieren. VB - DataTable: schnelle Erstellung eines DataRow-Objekts. Manchmal benötigt man schnell eine Daten-Klasse (DataFactory), die eine Zeile einer DataTable zurückgibt.Natürlich mit schnellem Austausch der Daten gegenseitig und komfortablen Zugriff auf die Daten per Feldnamen. Vorgehensweise:1. Einmalig eine abstrakte Klasse erstellen, immer wieder verwendbar (hier: DataClass(Of T)). 2. Datenfeldnamen einer Tabelle in einer Enumerations festlegen. 3. Erstellung der Datenklasse (6 Zeilen) mit Inherits DataClass und Verweis auf die Eunumeration. Gewusst wie: Serialisieren eines Objekts in XML mithilfe von Visual C# This step-by-step article describes how to serialize an object to XML by using Visual C#.

This method is useful for persisting the state of an object. This method is also useful for cloning an object by de-serializing the XML back to a new object. Requirements The following list outlines the recommended hardware, software, network infrastructure, and service packs that are required: Microsoft Visual StudioThis article assumes that you are familiar with the following topics: General familiarity with XML General familiarity with Visual C# XML Serialization Serialization is the process of taking the state of an object and persisting it in some fashion. The Microsoft .NET Framework includes powerful objects that can serialize any object to XML. Follow these steps to create a console application that creates an object, and then serializes its state to XML: In Visual C#, create a new Console Application project. Complete Code Listing Verification <? Troubleshoot. High-Performance Timer in C#

Download source files - 4.35 Kb Introduction In some applications exact time measurement methods are very important. The often used Windows API method GetTickCount() retrieves the number of milliseconds that have elapsed since the system was started, but the GetTickCount() function only archieve resolutions of 1ms and on the other side they are very imprecise.

So, for exact time measurement we should find another method. High resolution timing is supported in Win32 by the QueryPerformanceCounter() and QueryPerformanceFrequency() API methods. This timer functions has much better resolution than the "standard" millisecond-based timer calls, like the GetTickCount() method. The first call, QueryPerformanceCounter(), queries the actual value of the high-resolution performance counter at any point. The elapsed time can be computed then, by dividing this difference by the number of counts per second that the high-resolution counter performs (the frequency of the high-resolution timer). The Code.

Tutorials & Books

DataGridView » Die Codezentrale. Dateien. String Enumerations in C# Introduction The idea of string enumerations in C# (and the lack thereof), has bothered me for a while. Enum's are useful things but only allow the storage of numeric types. What if you want to use strings? Background It struck me that I had a number of requirements when using string 'constants'. I wanted the ability to define the values in-line and reference them like an enum value - e.g. MyEnum.MyString. Options Constants The first thing I naturally gravitated towards was constants defined in a specific class. Public sealed class MyConsts { private MyConsts() {} public const string Val1 = "MyVal1"; public const string Val2 = "MyVal2"; public const string Val3 = "MyVal3"; } The constants can be easily accessed as MyConsts.Val1 etc.

Constants do have an interesting side effect in that the values are actually copied to any client code that uses the class. Static readonly readonly values can be initialized with a value and changed only within a class's constructor. Enums StringEnum Using the code. How-To Program with Microsoft Office Excel and C# using a Ribbon and Interop. In the previous example (How-To program with Excel and C#), I demonstrated how to program in Excel 2007 using a Workbook Project in Visual Studio 2008. This example will use the Addin Project in Visual Studio 2008 to create a ribbon that can be inserted into any Excel file automatically.

Getting Started If you are familiar with VS2008, start by creating a Microsoft Office 2007 Excel Addin Project. If you don't have the 2007 Office VSTO templates, you can download them from the Microsoft Download site. If you are new to VS2008, start by creating a project. You can name your project anything you like. Add Form for Dialogbox In this step we are going to add a Windows Form to the project. Right-Click the Project in the Solution Explorer window, click Add->Windows Form. Once the form is created in the editor, I will add a TextBox, Label and Button from the Toolbox. Select the Textbox component and change the following properties in the Properties window: //Hide the dialogbox this.Hide(); Decaying Code | Where code comes to die. C# - Calling null on a class vs Dispose() Blind Date.

C# iTunes

Spieleprogrammierung mit dem XNA Framework - 2D-Texturen zeichnen - Video 1.