<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:syn="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/">
  <channel rdf:about="http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced">
    <title>gmane.comp.windows.devel.dotnet.advanced</title>
    <link>http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced</link>
    <description/>
    <syn:updatePeriod>hourly</syn:updatePeriod>
    <syn:updateFrequency>1</syn:updateFrequency>
    <syn:updateBase>1901-01-01T00:00+00:00</syn:updateBase>
    <items>
      <rdf:Seq>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16464"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16463"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16462"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16461"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16460"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16459"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16458"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16457"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16456"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16455"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16454"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16453"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16452"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16451"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16450"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16449"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16448"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16447"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16446"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16445"/>
      </rdf:Seq>
    </items>
    <image rdf:resource="http://gmane.org/img/gmane-25t.png"/>
    <textinput rdf:resource=""/>
  </channel>
  <image rdf:about="http://gmane.org/img/gmane-25t.png">
    <title>Gmane</title>
    <url>http://gmane.org/img/gmane-25t.png</url>
    <link>http://gmane.org</link>
  </image>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16464">
    <title>Expiration of your subscription to the ADVANCED-DOTNET list</title>
    <link>http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16464</link>
    <description>&lt;pre&gt;
Wed, 9 Jun 2010 06:07:58

Your subscription  to the ADVANCED-DOTNET  list has expired and  you have
failed to  confirm it  in the 20  day period that  you had  been granted.
Therefore, you have been automatically removed from the list. If you want
to  re-subscribe  to  the  list,  then  send  the  following  command  to
LISTSERV&amp;lt; at &amp;gt;PEACH.EASE.LSOFT.COM:

                        SUBscribe ADVANCED-DOTNET

You can also re-subscribe at:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ADVANCED-DOTNET.


&lt;/pre&gt;</description>
    <dc:creator>PEACH.EASE.LSOFT.COM LISTSERV Server (16.0</dc:creator>
    <dc:date>2010-06-09T10:07:58</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16463">
    <title>Re: Unable to debug in VS 2008 after updating Assembly version using Hg shortrev</title>
    <link>http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16463</link>
    <description>&lt;pre&gt;JFTR ... problem solved

On Wed, May 26, 2010 at 2:28 PM, Olemis Lang &amp;lt;olemis+win&amp;lt; at &amp;gt;gmail.com&amp;gt; wrote:
[...]
[...]

The problem was that Assembly version in workflow.xml was still
1.0.0.0 (rather than latest calculated version 1.0.0.14 )


Adding the target shown below to the build script (see
GenerateAssemblyInfo in previous message ;o)

{{{
#!xml

  &amp;lt;!--
    Update CodeBesideAssembly Version in workflow.xml manifest file
    based on the current Mercurial Revision. If missing it's
    impossible to debug the workflow in MS VS 2008, and there will
    be many deployment issues.
  --&amp;gt;
  &amp;lt;PropertyGroup&amp;gt;
    &amp;lt;BuildDependsOn&amp;gt;
      UpdateWorkflowManifest;
      $(BuildDependsOn)
    &amp;lt;/BuildDependsOn&amp;gt;
  &amp;lt;/PropertyGroup&amp;gt;

  &amp;lt;Target Name="UpdateWorkflowManifest"
          Condition=" '$(MSBuildCommunityTasksAvailable)' == 'true' "
          DependsOnTargets="GenerateAssemblyInfo"&amp;gt;
    &amp;lt;XmlUpdate
        Prefix="sp"
        Namespace="http://schemas.microsoft.com/sharepoint/"
        XmlFileName="$(MSBuildProjectDirec&lt;/pre&gt;</description>
    <dc:creator>Olemis Lang</dc:creator>
    <dc:date>2010-05-27T21:17:49</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16462">
    <title>Unable to debug in VS 2008 after updating Assembly version using Hg shortrev</title>
    <link>http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16462</link>
    <description>&lt;pre&gt;Hello !

I am using MS Visual Studio 2008. Recently I developed a custom
workflow for a MOSS 2007 WSS 3.0 site. Everything works OK (so this is
just background information ;o) , and I can deploy and debug the
workflow . I manage the source code using Mercurial SCM , hence I also
use VS Mercurial plugin . Then I installed «MSBuild Mercurial Tasks
Class Library» as well as «MSBuild Community Tasks» because I want to
increment the Assembly Version Number automatically and consistently
so that it will match the local revision number in Hg repos .

In order to do that I added an HgVersion.targets (similar to the
example) file that includes something like this :

{{{
#!xml

 &amp;lt;Target Name="GenerateAssemblyInfo"
         Condition=" '$(MSBuildCommunityTasksAvailable)' == 'true' "
         DependsOnTargets="ExtractRevision"&amp;gt;
   &amp;lt;PropertyGroup Condition=" '$(AssemblyVersionRevision)' == '' "&amp;gt;
     &amp;lt;AssemblyVersionRevision&amp;gt;0&amp;lt;/AssemblyVersionRevision&amp;gt;
   &amp;lt;/PropertyGroup&amp;gt;
   &amp;lt;CreateProperty Value=&lt;/pre&gt;</description>
    <dc:creator>Olemis Lang</dc:creator>
    <dc:date>2010-05-26T19:28:17</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16461">
    <title>Re: Key compare in Dictionary</title>
    <link>http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16461</link>
    <description>&lt;pre&gt;I have found this documentation
http://msdn.microsoft.com/en-us/library/xfhwa508.aspx

It vaguely words that a hash is required for the key class.

Perhaps it should be stated more firmly that equal keys *must* have
equal hashes, thus Object.GetHashCode *must* be overridden when
implementing IEquatable or when overriding Object.Equals.

At least the C# compiler warns with "'xxx' overrides
Object.Equals(object o) but does not override Object.GetHashCode()"
...

// Ryan

On Fri, May 21, 2010 at 8:31 AM, Mark Hurd &amp;lt;markehurd&amp;lt; at &amp;gt;gmail.com&amp;gt; wrote:

===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives

&lt;/pre&gt;</description>
    <dc:creator>Ryan Heath</dc:creator>
    <dc:date>2010-05-21T07:26:54</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16460">
    <title>Re: Key compare in Dictionary</title>
    <link>http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16460</link>
    <description>&lt;pre&gt;
Does that suggest a DocErr where it says Implementing IEquatable(Of T)
is enough for it to be used?

&lt;/pre&gt;</description>
    <dc:creator>Mark Hurd</dc:creator>
    <dc:date>2010-05-21T06:31:27</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16459">
    <title>Re: Key compare in Dictionary</title>
    <link>http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16459</link>
    <description>&lt;pre&gt;That was it.

Thanks
David.

===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives

&lt;/pre&gt;</description>
    <dc:creator>David Nicholson</dc:creator>
    <dc:date>2010-05-20T11:21:40</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16458">
    <title>Re: Key compare in Dictionary</title>
    <link>http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16458</link>
    <description>&lt;pre&gt;You need to override GetHashCode and Equals.  It needs to look something
like this:

    public class KeyData : IEquatable&amp;lt;KeyData&amp;gt; {
        public string F1 { get; set; }
        public int F2 { get; set; }
        public KeyData(string f1, int f2) {
            F1 = f1;
            F2 = f2;
        }

        public bool Equals(KeyData other) {
            if (ReferenceEquals(null, other)) return false;
            if (ReferenceEquals(this, other)) return true;
            return Equals(other.F1, F1) &amp;amp;&amp;amp; other.F2 == F2;
        }
        public override bool Equals(object obj) {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            if (obj.GetType() != typeof(KeyData)) return false;
            return Equals((KeyData)obj);
        }
        public override int GetHashCode() {
            unchecked {
                return ((F1 != null ? F1.GetHashCode() : 0) * 397) ^ F2;
            }
        }
        public static bool operator ==(K&lt;/pre&gt;</description>
    <dc:creator>Mike Andrews</dc:creator>
    <dc:date>2010-05-20T10:49:44</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16457">
    <title>Re: Key compare in Dictionary</title>
    <link>http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16457</link>
    <description>&lt;pre&gt;I always override Object.GetHashCode and Object.Equals for these sorts
of things ...

// Ryan

On Thu, May 20, 2010 at 12:32 PM, David Nicholson &amp;lt;davidn&amp;lt; at &amp;gt;superpay.co.uk&amp;gt; wrote:

===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives

&lt;/pre&gt;</description>
    <dc:creator>Ryan Heath</dc:creator>
    <dc:date>2010-05-20T10:48:03</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16456">
    <title>Key compare in Dictionary</title>
    <link>http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16456</link>
    <description>&lt;pre&gt;I am using a class as a key to a Dictionary, and the key comparisons are not working as I expect. The example below illustrates:

// This is the key of the dictionary
namespace DictionaryTest
{
    using System;
    public class KeyData : IEquatable&amp;lt;KeyData&amp;gt;
    {
        public string F1 { get; set; }
        public int F2 { get; set; }

        public KeyData(string f1, int f2)
        {
            F1 = f1;
            F2 = f2;
        }

        bool IEquatable&amp;lt;KeyData&amp;gt;.Equals(KeyData other)
        {
            if (String.Compare(F1, other.F1, true) != 0)
                return false;

            if (F2 != other.F2)
                return false;

            return true;
        }
    }
}

and I am using it like this:

namespace DictionaryTest
{
   using System;
   using System.Collections.Generic;
    class Program
    {
        static void Main(string[] args)
        {
            var d1 = new Dictionary&amp;lt;KeyData, int&amp;gt;();

            d1.Add(new KeyData("a", 1), 1);
            d1.Add(new KeyData("b"&lt;/pre&gt;</description>
    <dc:creator>David Nicholson</dc:creator>
    <dc:date>2010-05-20T10:32:46</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16455">
    <title>Re: Extract method refactor (C# in VS 2010)</title>
    <link>http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16455</link>
    <description>&lt;pre&gt;Well, that was pretty obvious when you point it out!

Thanks
David.

===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives

&lt;/pre&gt;</description>
    <dc:creator>David Nicholson</dc:creator>
    <dc:date>2010-05-19T14:43:37</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16454">
    <title>Re: Extract method refactor (C# in VS 2010)</title>
    <link>http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16454</link>
    <description>&lt;pre&gt;In your first section of code, if you find a "b" you return out of DoSomething, and x is never set to "Hello"

In your hand-refactored code, if you find a "b", you return out of f - and execution continues, x is set to "Hello", etc
(i.e. your hand-refactored code is not equivalent)

Chris


On Wed, 19 May 2010 10:20:39 -0400, David Nicholson &amp;lt;davidn&amp;lt; at &amp;gt;SUPERPAY.CO.UK&amp;gt; wrote:


===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives

&lt;/pre&gt;</description>
    <dc:creator>Chris Anderson</dc:creator>
    <dc:date>2010-05-19T14:31:39</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16453">
    <title>Extract method refactor (C# in VS 2010)</title>
    <link>http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16453</link>
    <description>&lt;pre&gt;I have a function like this:

        private void DoSomething(List&amp;lt;string&amp;gt; slist)
        {
            foreach (string s in slist)
            {
                if (s == "b")
                    return;
            }

            string x = "Hello";
        }

and I select all of the foreach loop. If I refactor/extract method I get a message saying that all paths must be terminated by a return statement if any are.

If I remove the assignment to x at the end (outside the part I want to refactor), it works.

I don't understand why the assignment stops it doing something like this:

        private void DoSomething(List&amp;lt;string&amp;gt; slist)
        {
            f(slist);

            string x = "World";
        }

        private static void f(List&amp;lt;string&amp;gt; slist)
        {
            foreach (string s in slist)
            {
                if (s == "b")
                    return;
            }
        }

Thanks
David.

===================================
View archives and manage your subscription(s) at http://&lt;/pre&gt;</description>
    <dc:creator>David Nicholson</dc:creator>
    <dc:date>2010-05-19T14:20:39</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16452">
    <title>Re: Getting a byte array from a generic class</title>
    <link>http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16452</link>
    <description>&lt;pre&gt;That's actually a great use of a dynamic.  Cool.

--
Steve Johnson

On Tue, May 18, 2010 at 12:55 PM, Peter Ritchie &amp;lt;
advanced.dotnet.discuss.develop.com&amp;lt; at &amp;gt;peterritchie.com&amp;gt; wrote:


===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives

&lt;/pre&gt;</description>
    <dc:creator>Steve Johnson</dc:creator>
    <dc:date>2010-05-18T17:05:08</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16451">
    <title>Re: Getting a byte array from a generic class</title>
    <link>http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16451</link>
    <description>&lt;pre&gt;This is interesting and elegant. I will look into it.

Thanks Peter!


-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:ADVANCED-DOTNET&amp;lt; at &amp;gt;PEACH.EASE.LSOFT.COM] On Behalf Of Peter Ritchie
Sent: Tuesday, May 18, 2010 12:55 PM
To: ADVANCED-DOTNET&amp;lt; at &amp;gt;PEACH.EASE.LSOFT.COM
Subject: Re: [ADVANCED-DOTNET] Getting a byte array from a generic class

Rather than the bad smell of a type comparison, I prefer to use a more object-oriented approach with polymorphism (overloading in this example).  But, since we're dealing with a generic class that's trying to use a non-generic method; this get's a little tricky.  

If you're using .NET 4.0, you can create a dynamic variable of the value and let the runtime deal with finding the overload.  For example:
public abstract class NumericNtcipObject&amp;lt;T&amp;gt; where T : struct
{
private readonly T value;

protected NumericNtcipObject(T value)
{
this.value = value;
}

private static byte[] ToArray(int v)
{
return BitConver&lt;/pre&gt;</description>
    <dc:creator>Eddie Lascu</dc:creator>
    <dc:date>2010-05-18T17:01:41</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16450">
    <title>Re: Getting a byte array from a generic class</title>
    <link>http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16450</link>
    <description>&lt;pre&gt;Rather than the bad smell of a type comparison, I prefer to use a more object-oriented approach with polymorphism (overloading in this example).  But, since we're dealing with a generic class that's trying to use a non-generic method; this get's a little tricky.  

If you're using .NET 4.0, you can create a dynamic variable of the value and let the runtime deal with finding the overload.  For example:
public abstract class NumericNtcipObject&amp;lt;T&amp;gt; where T : struct
{
private readonly T value;

protected NumericNtcipObject(T value)
{
this.value = value;
}

private static byte[] ToArray(int v)
{
return BitConverter.GetBytes(v);
}

private static byte[] ToArray(uint v)
{
return BitConverter.GetBytes(v);
}
//...
public byte[] ValueAsByteStream()
{
dynamic temp = value;
try
{
return ToArray(temp);
}
catch (Microsoft.CSharp.RuntimeBinder.RuntimeBinderException)
{
return null;
}
}
}

If you're not using .NET 4.0 (and using .NET 3.x) then you can use &lt;/pre&gt;</description>
    <dc:creator>Peter Ritchie</dc:creator>
    <dc:date>2010-05-18T16:55:13</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16449">
    <title>Re: Getting a byte array from a generic class</title>
    <link>http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16449</link>
    <description>&lt;pre&gt;OK, then do it this way:

public IntPtr AsByteArray(out int length)
{
    length = Marshal.SizeOf(typeof(T));

    IntPtr pb = Marshal.AllocHGlobal(length);

    Marshal.StructureToPtr(_value, pb, false);

    return pb;
}

--
Steve Johnson

On Tue, May 18, 2010 at 12:31 PM, Eddie Lascu &amp;lt;elascu&amp;lt; at &amp;gt;ibigroup.com&amp;gt; wrote:


===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives

&lt;/pre&gt;</description>
    <dc:creator>Steve Johnson</dc:creator>
    <dc:date>2010-05-18T16:51:04</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16448">
    <title>Re: Getting a byte array from a generic class</title>
    <link>http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16448</link>
    <description>&lt;pre&gt;as per http://msdn.microsoft.com/en-us/library/5s4920fa.aspx
what if you call this on a generic to get sizeof - does that work?

Console.WriteLine("Number of bytes needed by a Point object: {0}",
    Marshal.SizeOf(typeof(Point)));



On Tue, May 18, 2010 at 12:29 PM, Adam Tuliper &amp;lt;amt&amp;lt; at &amp;gt;gecko-software.com&amp;gt;wrote:


===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives

&lt;/pre&gt;</description>
    <dc:creator>Adam Tuliper</dc:creator>
    <dc:date>2010-05-18T16:36:18</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16447">
    <title>Re: Getting a byte array from a generic class</title>
    <link>http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16447</link>
    <description>&lt;pre&gt;funny I was seeing if there was a way to get this for a generic and saw this
posting
http://bytes.com/topic/c-sharp/answers/479712-sizeof-t-c-2-0-generic-classes
which references this:
http://msdn.microsoft.com/en-us/library/ms379564

which may be along the lines of what Steve said above.. but with code for a
GenericBinaryFormatter



On Tue, May 18, 2010 at 12:25 PM, Eddie Lascu &amp;lt;elascu&amp;lt; at &amp;gt;ibigroup.com&amp;gt; wrote:


===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives

&lt;/pre&gt;</description>
    <dc:creator>Adam Tuliper</dc:creator>
    <dc:date>2010-05-18T16:29:09</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16446">
    <title>Re: Getting a byte array from a generic class</title>
    <link>http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16446</link>
    <description>&lt;pre&gt;The problem is not bandwidth, as I would not have to serialize a ton of objects, but the actual size. These objects are wrapped in SNMP packets and sent down to field devices (dynamic message signs, speed detectors, traffic controllers, etc.). A field device will expect an integer to arrive encoded in 4 bytes, not 8. Binary serialization doesn't work for the exact same reason - the overhead bytes will be interpreted by something else and will confuse the field device.

Thanks anyway for your suggestions.

Regards,
Eddie


-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:ADVANCED-DOTNET&amp;lt; at &amp;gt;PEACH.EASE.LSOFT.COM] On Behalf Of Steve Johnson
Sent: Tuesday, May 18, 2010 12:24 PM
To: ADVANCED-DOTNET&amp;lt; at &amp;gt;PEACH.EASE.LSOFT.COM
Subject: Re: [ADVANCED-DOTNET] Getting a byte array from a generic class

Some other ideas, but they have issues:

1 - You could use binary serialization, but that would have a bunch of
overhead.

2 - Since you will only be supporting numeric primitives, you could do the
fol&lt;/pre&gt;</description>
    <dc:creator>Eddie Lascu</dc:creator>
    <dc:date>2010-05-18T16:31:00</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16445">
    <title>Re: Getting a byte array from a generic class</title>
    <link>http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16445</link>
    <description>&lt;pre&gt;Actually, you'd have to use decimal instead of double in order for #2 to
work.  You didn't include decimal in your original message, but I now
understand that those types were merely examples.

--
Steve Johnson

On Tue, May 18, 2010 at 12:23 PM, Steve Johnson &amp;lt;sjjohnson&amp;lt; at &amp;gt;pobox.com&amp;gt; wrote:


===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives

&lt;/pre&gt;</description>
    <dc:creator>Steve Johnson</dc:creator>
    <dc:date>2010-05-18T16:30:53</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16444">
    <title>Re: Getting a byte array from a generic class</title>
    <link>http://permalink.gmane.org/gmane.comp.windows.devel.dotnet.advanced/16444</link>
    <description>&lt;pre&gt;Actually the method I included below would not compile. This is one that is complete and compiles:


        /// &amp;lt;summary&amp;gt;
        /// Get property to obtain a byte stream representation of the value of this NTCIP object
        /// &amp;lt;/summary&amp;gt;
        public override byte[] ValueAsByteStream
        {
            get
            {
                // signed integers
                if (typeof(T) == typeof(SByte))
                {
                    return BitConverter.GetBytes(Convert.ToSByte(Value));
                }
                if (typeof(T) == typeof(Int16))
                {
                    return BitConverter.GetBytes(Convert.ToInt16(Value));
                }
                if (typeof(T) == typeof(Int32))
                {
                    return BitConverter.GetBytes(Convert.ToInt32(Value));
                }
                if (typeof(T) == typeof(Int64))
                {
                    return BitConverter.GetBytes(Convert.ToInt64(Value));
                }

                // uns&lt;/pre&gt;</description>
    <dc:creator>Eddie Lascu</dc:creator>
    <dc:date>2010-05-18T16:25:54</dc:date>
  </item>
  <textinput rdf:about="http://search.gmane.org/?group=$group=gmane.comp.windows.devel.dotnet.advanced">
    <title>Search Engine</title>
    <description>Search the mailing list at Gmane</description>
    <name>query</name>
    <link>http://search.gmane.org/?group=$group=gmane.comp.windows.devel.dotnet.advanced</link>
  </textinput>
</rdf:RDF>

