473,398 Members | 2,335 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Serializable could not be found name could not be found problem

I get the following compilation error:
"The type or namespace name 'Serializable' could not be found (are you
missing a using directive or an assembly reference?)"

Can anyone tell me why the following code will not compile? I thought the
"Serializable" attribute was located in the System.Runtime.Serialization
assembly. I'm trying to stream this structure to/from a byte array.

using System.Runtime.InteropServices;
using System.Runtime.Serialization;

namespace PetToolTCPLib
{
[Serializable]
public struct MIX_CompleteIllumStateMsg
{
public MIX_MISC_ENUMS som; // start of message sentinel always set
to 0xC0DEF00D
public uint length; // total message length in bytes
public MIX_MessageId msgId; // message id
public MESSAGE_LOG_HEADER_STRUCT theHeader;
public MESSAGE_LOG_RUN_PERIODIC_STRUCT theRealTimeInfo;
}
}

Nov 16 '05 #1
5 12719
Try adding "using System;" to you other using entries.

--
Jared Parson [MSFT]
ja******@online.microsoft.com

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

"Ben Terry" <bt@charter.net> wrote in message
news:u0**************@TK2MSFTNGP10.phx.gbl...
I get the following compilation error:
"The type or namespace name 'Serializable' could not be found (are you
missing a using directive or an assembly reference?)"

Can anyone tell me why the following code will not compile? I thought the
"Serializable" attribute was located in the System.Runtime.Serialization
assembly. I'm trying to stream this structure to/from a byte array.

using System.Runtime.InteropServices;
using System.Runtime.Serialization;

namespace PetToolTCPLib
{
[Serializable]
public struct MIX_CompleteIllumStateMsg
{
public MIX_MISC_ENUMS som; // start of message sentinel always set
to 0xC0DEF00D
public uint length; // total message length in bytes
public MIX_MessageId msgId; // message id
public MESSAGE_LOG_HEADER_STRUCT theHeader;
public MESSAGE_LOG_RUN_PERIODIC_STRUCT theRealTimeInfo;
}
}

Nov 16 '05 #2
The Serializable attribute cannot be applied to a struct since all value
types (including structs) are automatically serializable.

Ken
"Ben Terry" <bt@charter.net> wrote in message
news:u0**************@TK2MSFTNGP10.phx.gbl...
I get the following compilation error:
"The type or namespace name 'Serializable' could not be found (are you
missing a using directive or an assembly reference?)"

Can anyone tell me why the following code will not compile? I thought the
"Serializable" attribute was located in the System.Runtime.Serialization
assembly. I'm trying to stream this structure to/from a byte array.

using System.Runtime.InteropServices;
using System.Runtime.Serialization;

namespace PetToolTCPLib
{
[Serializable]
public struct MIX_CompleteIllumStateMsg
{
public MIX_MISC_ENUMS som; // start of message sentinel always set
to 0xC0DEF00D
public uint length; // total message length in bytes
public MIX_MessageId msgId; // message id
public MESSAGE_LOG_HEADER_STRUCT theHeader;
public MESSAGE_LOG_RUN_PERIODIC_STRUCT theRealTimeInfo;
}
}

Nov 16 '05 #3
On 12 Jul 2004 16:39, "Ken Kolda" wrote:
The Serializable attribute cannot be applied to a struct since all value
types (including structs) are automatically serializable.

Ken

How about:

public struct ABC {
public Hashtable myHashtable;
}

There's a perfectly valid struct. How's it going to serialise tha Hashtable?
And you can apply the attribute to it.

Simon Smith
simon dot s at ghytred dot com
www.ghytred.com/NewsLook - NNTP Client for Outlook


"Ben Terry" <bt@charter.net> wrote in message
news:u0**************@TK2MSFTNGP10.phx.gbl...
I get the following compilation error:
"The type or namespace name 'Serializable' could not be found (are you
missing a using directive or an assembly reference?)"

Can anyone tell me why the following code will not compile? I thought the
"Serializable" attribute was located in the System.Runtime.Serialization
assembly. I'm trying to stream this structure to/from a byte array.

using System.Runtime.InteropServices;
using System.Runtime.Serialization;

namespace PetToolTCPLib
{
[Serializable]
public struct MIX_CompleteIllumStateMsg
{
public MIX_MISC_ENUMS som; // start of message sentinel always set
to 0xC0DEF00D
public uint length; // total message length in bytes
public MIX_MessageId msgId; // message id
public MESSAGE_LOG_HEADER_STRUCT theHeader;
public MESSAGE_LOG_RUN_PERIODIC_STRUCT theRealTimeInfo;
}
}


Nov 16 '05 #4
You're right -- my bad. Thanks for the correction.

Ken
"Simon Smith" <gh*****@community.nospam> wrote in message
news:44******************************@ghytred.com. ..
On 12 Jul 2004 16:39, "Ken Kolda" wrote:
The Serializable attribute cannot be applied to a struct since all value
types (including structs) are automatically serializable.

Ken

How about:

public struct ABC {
public Hashtable myHashtable;
}

There's a perfectly valid struct. How's it going to serialise tha

Hashtable? And you can apply the attribute to it.

Simon Smith
simon dot s at ghytred dot com
www.ghytred.com/NewsLook - NNTP Client for Outlook


"Ben Terry" <bt@charter.net> wrote in message
news:u0**************@TK2MSFTNGP10.phx.gbl...
I get the following compilation error:
"The type or namespace name 'Serializable' could not be found (are you
missing a using directive or an assembly reference?)"

Can anyone tell me why the following code will not compile? I thought the "Serializable" attribute was located in the System.Runtime.Serialization assembly. I'm trying to stream this structure to/from a byte array.

using System.Runtime.InteropServices;
using System.Runtime.Serialization;

namespace PetToolTCPLib
{
[Serializable]
public struct MIX_CompleteIllumStateMsg
{
public MIX_MISC_ENUMS som; // start of message sentinel always set
to 0xC0DEF00D
public uint length; // total message length in bytes
public MIX_MessageId msgId; // message id
public MESSAGE_LOG_HEADER_STRUCT theHeader;
public MESSAGE_LOG_RUN_PERIODIC_STRUCT theRealTimeInfo;
}
}


Nov 16 '05 #5
Thanks, Jared. That adding "using System;" did the trick.

"Jared Parsons [MSFT]" <ja******@online.microsoft.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Try adding "using System;" to you other using entries.

--
Jared Parson [MSFT]
ja******@online.microsoft.com

This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

"Ben Terry" <bt@charter.net> wrote in message
news:u0**************@TK2MSFTNGP10.phx.gbl...
I get the following compilation error:
"The type or namespace name 'Serializable' could not be found (are you
missing a using directive or an assembly reference?)"

Can anyone tell me why the following code will not compile? I thought the "Serializable" attribute was located in the System.Runtime.Serialization
assembly. I'm trying to stream this structure to/from a byte array.

using System.Runtime.InteropServices;
using System.Runtime.Serialization;

namespace PetToolTCPLib
{
[Serializable]
public struct MIX_CompleteIllumStateMsg
{
public MIX_MISC_ENUMS som; // start of message sentinel always set to 0xC0DEF00D
public uint length; // total message length in bytes
public MIX_MessageId msgId; // message id
public MESSAGE_LOG_HEADER_STRUCT theHeader;
public MESSAGE_LOG_RUN_PERIODIC_STRUCT theRealTimeInfo;
}
}


Nov 16 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: xmail123 | last post by:
Hi, As was pointed out whatever you return from a WebMethod needs to be serializable to SOAP. An ArrayList is not serializable. I will be needing to return other data types from web methods. ...
2
by: John | last post by:
Hi What is a Serializable class compared to a normal class? Thanks Regards
9
by: Developer | last post by:
Hi, How can one tell wsdl.exe/VS.NET web service proxy generatioon to to put on imported classes? For example, i fin your web service you use a class: class Data { }
2
by: Frank Uray | last post by:
Hi again I have a little problem with "serializable" a control ... I am creating AppDomain, Assembly and Instance. All works fine. My "base" class for the instance inherit from: -...
3
by: Techno_Dex | last post by:
I'm wanting to create a Wrapper (or Extender depending on how you look at it) for a Serializable object that I then want to send over a webservice. Basically I want to create a Serializable Object,...
4
by: dani k | last post by:
How do I write my own serialization of a class that has non-serializable data members? this problem arose when I tried to serialize RSAParameters, for which the private stuff is not serializable
0
by: ChopDown | last post by:
Hi, I want to send/receive a serializable object in socket: ==========sender========== Dim MyMessage As New MessageClass.Message() Dim client As New TcpClient...
0
mmfranke
by: mmfranke | last post by:
Hello. Hi. I'm writing a logging service that uses .NET remoting. The idea is that the service publishes an EventProcessor object that clients can access via .NET Remoting, passing it...
5
by: cctv.star | last post by:
I need to maintain certain data structure, shared by all instances of a class, declared as . This data structure must change whenever a new object is created or an existing object is destroyed. So...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.