Main Site Documentation

Net 4.1


#1

I was hoping that 4.1 would fix some of the incompatabilities between the desktop .NET and micro .NET, such as StringBuilder class and BitConverter, and int16 hex parsing etc,
nothing to do with Fez but maybe spark a discussion ::slight_smile:


#2

It won’t! The desktop full .NET framework is made to work on PC with 3Ghz processors and unlimited RAM!..Micro Framework is made to work on VERY VERY small devices with very little resources.


#3

Indeed, why would you want such complete framework for a 72Mhz 32-bit ARM processor?


#4

I think he just wants MF to be more like the full .NET in some trivial ways. I don’t think OP is suggesting that the entire .NET implementation should be ported ot FEZ (which is obviously not possible) .


#5

You will always run onto some class here or there that is needed by one of the users. Fulfilling all those basically meaning adding everything from full.NET.

The good news is that NETMF is getting more andf more popular so we will always see more and more functionality.

Do you know what is the best part? IT is that you get all these for free…juts update your firmware ;)…we do all the work for you :o


#6

chris exactly so, I was hoping that where micro.net and pc .net shared functionality, then they could be the same interfaces, I have used the same code on PC .NET, .NET Compact Framework and .NET micro, but have to use a few #defines
I think the problem is that if an interface exists within the same namespace it has to be identical to the full framework even if you just want to use a subset of functionality, ie StringBuilder.


#7

Some things I have found to be very compatible, some… Not so much.

I agree with you that certain parts need to be reengineered to me more like their unlimited-resourced counterpart.

I will note, however, that I am usually able to port code back and forth between my FEZ and my PC with little effort at all. sometimes I have to change a using or two, but I have even copied full applications before with few ill effects.


#8

When you want to write portable code, you usually want to write it on NETMF first and then make it happen on the PC.

As for string builder, this seem to be requested enough to have in near future.
See this
http://www.netmf.com/Discussion/Forums/SingleForum/SingleThread.aspx?mode=singleThread&thread=475d3278-0dc6-456c-9294-6c4e5ee1a7bd


#9

I guess (hope?) microsoft will listen to this, then :slight_smile:


#10

I have a feeling that although NETMF is perfectly usable now, it’s probably going to come together a lot more in the future.


#11

It’s still in development, so yes :slight_smile:


#12

I was hoping for the StringBuilder class as well… Right now I have to do my own string processing for my lcd display… :frowning:


#13

The Stringbuilder should be included in the MFDpwsExtensions assembly

It is described here

http://msdn.microsoft.com/en-us/library/ee436408.aspx

But it is not included.Anybody know the reason? Or is it a typo and it is in an another assembly?


#14

I also miss the BitConverter class BitConverter.ToString( byte[] ) for dumping out hex packets, all easy to write of course, but considering this is an embedded platform that kind of utility should be there (imho)


#15

here is what I implemented


namespace System
{
    // SPOT doesnt have this class so well make one 
    // maybe later it will be included
    class BitConverter
    {
        public static string ToString(byte[] data, int offset, int count)
        {
            const string hex = "0123456789ABCDEF";

            // convert bytes to a hex string???
            char[] chars = new char[count * 3 - 1];
            int index = 0;

            //foreach (byte b in data)
            for (int n = 0; n < count; n++)
            {
                byte b = data[offset + n];
                chars[index++] = hex[b / 16];
                chars[index++] = hex[b % 16];
                if (index < chars.Length)
                    chars[index++] = '-';
            }

            return new string(chars);
        }

        public static string ToString(byte[] data)
        {
            return ToString(data, 0, data.Length);
        }

        public static UInt16 ToUInt16(byte[] data, int offset)
        {
            return (UInt16)Microsoft.SPOT.Hardware.Utility.ExtractValueFromArray(data, offset, 2);
        }

        public static UInt32 ToUInt32(byte[] data, int offset)
        {
            return (UInt32)Microsoft.SPOT.Hardware.Utility.ExtractValueFromArray(data, offset, 4);
        }
    }
}