DisplayClaim.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / infocard / Service / managed / Microsoft / InfoCards / DisplayClaim.cs / 1 / DisplayClaim.cs

                            //------------------------------------------------------------------------------ 
// Copyright (c) Microsoft Corporation.  All rights reserved.
//-----------------------------------------------------------------------------
namespace Microsoft.InfoCards
{ 
    using System;
    using System.Collections.Generic; 
    using System.IO; 

    // 
    // This class represents a single claim in the display token
    //
    class DisplayClaim
    { 
        string m_name;
        List m_value; 
        string m_description; 
        string m_uri;
 
        public string Name
        {
            get { return m_name; }
            set { m_name = value; } 
        }
 
        public string Id 
        {
            get { return m_uri; } 
        }

        public DisplayClaim( BinaryReader reader )
        { 
            Deserialize( reader );
        } 
 
        //
        // Summary 
        //  CTOR
        //
        // Parameters
        //  name - Display name of the claim 
        //  value - value of the claim
        //  description - description of the claims 
        //  uri - claim uri 
        //
        public DisplayClaim( string name, List value, string description, string uri ) 
        {
            m_name = name;
            m_value = value;
            m_description = description; 
            m_uri = uri;
        } 
 
        //
        // Summary 
        //   Serialize the display claim
        //
        // Parameter
        //   The writer to which the serialized data is written. 
        //
        public void Serialize( BinaryWriter writer ) 
        { 
            Utility.SerializeString( writer, m_name );
            writer.Write( ( UInt32 )m_value.Count ); 
            foreach( string val in m_value )
            {
                Utility.SerializeString( writer, val );
            } 
            Utility.SerializeString( writer, m_description );
            Utility.SerializeString( writer, m_uri ); 
 
        }
 
        //
        // Summary
        //   Deserialize the display claim
        // 
        // Parameter
        //   The reader from which the serialized data is read. 
        // 
        public void Deserialize( BinaryReader reader )
        { 
            m_name  = Utility.DeserializeString( reader );
            UInt32 count = reader.ReadUInt32();
            for( UInt32 i = 0; i < count; i++ )
            { 
                m_value.Add( Utility.DeserializeString( reader ) );
            } 
            m_description = Utility.DeserializeString( reader ); 
            m_uri = Utility.DeserializeString( reader );
 
        }

    }
} 

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.


                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK