Questions tagged [compact-framework]

Microsoft .Net Compact Framework (compact-framework, .netcf) is a constrained version of Microsoft .Net Framework designed for limited resource devices such as mobile phones, personal digital assistants and other embedded devices. Net Compact Framework also contains classes that are specific for mobile devices.

3094 questions
102
votes
6 answers

Function that creates a timestamp in c#

I was wondering, is there a way to create a timestamp in c# from a datetime? I need a millisecond precision value that also works in Compact Framework(saying that since DateTime.ToBinary() does not exist in CF). My problem is that i want to store…
73
votes
6 answers

Center text output from Graphics.DrawString()

I'm using the .NETCF (Windows Mobile) Graphics class and the DrawString() method to render a single character to the screen. The problem is that I can't seem to get it centred properly. No matter what I set for the Y coordinate of the location of…
Adam Haile
  • 30,705
  • 58
  • 191
  • 286
69
votes
10 answers

How best to read a File into List

I am using a list to limit the file size since the target is limited in disk and ram. This is what I am doing now but is there a more efficient way? readonly List LogList = new List(); ... var logFile =…
jacknad
  • 13,483
  • 40
  • 124
  • 194
66
votes
14 answers

What are the most valuable .Net Compact Framework Tips, Tricks, and Gotcha-Avoiders?

We work extensively in the .Net Compact Framework and Windows Mobile. I've seen plenty of questions come up regarding specifics to development of ASP.Net apps or other .Net based desktop apps but nothing CF specific. Anyone else a mobile developer…
Mat Nadrofsky
  • 8,289
  • 8
  • 49
  • 73
52
votes
14 answers

NLog does not create a log file

I am trying to add logging to an application running on mobile device with Windows Mobile 6.1. � .NET Compact framework 3.5. using NLog. I have the appropriate version of the NLog distribution installed. However no log files are being created. Here…
Srv19
  • 3,458
  • 6
  • 44
  • 75
50
votes
4 answers

Reading file content to string in .Net Compact Framework

I am developing an application for mobile devices with the .net compact framework 2.0. I am trying to load a file's content to a string object, but somehow I can't get it done. There is no ReadToEnd() method in the System.IO.StreamReader class. Is…
lng
  • 805
  • 1
  • 11
  • 31
46
votes
5 answers

How to get exe application name and version in C# Compact Framework

My application has an exe and uses some DLLs. I am writing all in C#. In one DLL I want to write a method to get the application name and version from the version information in the exe. I understand that in full .NET I could use GetEntryAssembly,…
cja
  • 9,512
  • 21
  • 75
  • 129
41
votes
4 answers

In C#, how can I tell if a property is static? (.Net CF 2.0)

FieldInfo has an IsStatic member, but PropertyInfo doesn't. I assume I'm just overlooking what I need. Type type = someObject.GetType(); foreach (PropertyInfo pi in type.GetProperties()) { // umm... Not sure how to tell if this property is…
CrashCodes
  • 3,237
  • 12
  • 38
  • 42
37
votes
3 answers

Disable compiler optimisation for a specific function or block of code (C#)

The compiler does a great job of optimising for RELEASE builds, but occasionally it can be useful to ensure that optimisation is turned off for a local function (but not the entire project by unticking Project Options > Optimize code). In C++ this…
AlainD
  • 5,413
  • 6
  • 45
  • 99
36
votes
7 answers

Allowing iteration without generating any garbage

I have the following code in an object pool that implements the IEnumerable interface. public IEnumerable ActiveNodes { get { for (int i = 0; i < _pool.Count; i++) { if (_pool[i].AvailableInPool) { …
Olhovsky
  • 5,466
  • 3
  • 36
  • 47
36
votes
4 answers

How can I create an instance of an arbitrary Array type at runtime?

I'm trying to deserialize an array of an type unknown at compile time. At runtime I've discovered the type, but I don't know how to create an instance. Something like: Object o = Activator.CreateInstance(type); which doesn't work because there is…
CrashCodes
  • 3,237
  • 12
  • 38
  • 42
36
votes
7 answers

Microsoft.CompactFramework.CSharp.targets was not found while opening projects

I tried to create a smart device project in Visual Studio 2008. Target Platform: Windows Mobile 5.0 Pocket PC SDK. .NET Compact Framework version: .NET Compact Framework 3.5 But I get the following error:
MARKAND Bhatt
  • 2,428
  • 10
  • 47
  • 80
35
votes
7 answers

Server-generated keys and server-generated values are not supported by SQL Server Compact

I just started to play with the entity framework, so I decided to connect it to my existing SQL Server CE database. I have a table with an IDENTITY(1, 1) primary key but when I tried to add an entity, I've got the above-mentioned error. From MS…
Sergey Aldoukhov
  • 22,316
  • 18
  • 72
  • 99
34
votes
2 answers

Read typed objects from XML using known XSD

I have the following (as an example) XML file and XSD. 2010-02-18T01:02:03 PT10H5M3S and version="1.0" encoding="utf-8"?>
Steven_W
  • 848
  • 1
  • 7
  • 17
30
votes
6 answers

Uri.EscapeDataString() - Invalid URI: The Uri string is too long

I'm using compact framework/C# on windows mobile. In my application I am uploading data to the server by serializing objects and using a HttpWebRequest/POST request to send the information up. On the server the post data is de-serialised and saved…
ETFairfax
  • 3,794
  • 8
  • 40
  • 58
1
2 3
99 100