Differences between XML.Serialization and Runtime.Serialization - serialization

Can anyone explain the differences between System.XML.Serialization and System.Runtime.Serialization ?

The System.Xml.Serialization namespace contains classes that are used to serialize objects into XML format documents or streams.
The System.Runtime.Serialization namespace contains classes that can be used for serializing and de-serializing objects.

Related

C++ using System.Drawing namespace

I'm quite a newbee in working with images. I need to use System.Drawing namespace and when i try to do it like this: using namespace System::Drawing; i have an error that System hasn't been declared. What should i do? Include somthing?
You need #using <System.Drawing.dll> and of course it have to be CLR project.

'IDTExtensibility2' is ambiguous in the namespace 'Extensibility'

I am trying to build a COM Add-In and I get the errors:
'IDTExtensibility2' is ambiguous in the namespace 'Extensibility'.
'ext_DisconnectMode' is ambiguous in the namespace 'Extensibility'.
'ext_ConnectMode' is ambiguous in the namespace 'Extensibility'.
My imports are as follows:
Imports Extensibility
Imports System.Runtime.InteropServices
Imports Microsoft.Office.Interop
Imports Microsoft.Office.Interop.Excel
Imports Microsoft.Office.Core
I used the shared add-in wizard in VS 2010 and I am using VB.NET.
The codes that have errors are anything that contains:
Extensibility.IDTExtensibility2
I couldn't find this anywhere and I figured the wizard would work without errors. Any thoughts? Thank you.
Check whether one of the Microsoft.* namespaces already imports the Extensibility namespace.
If not, there is possibly an upper-/lowercase ambiguity, try whether you can access the class in C# or through reflection.
If it still does not works, there probably goes something wrong during interop proxy generation but then it get's complicated, you have to use the tlbimp.exe tool and toy around with its options.

What is the format of the DataContractAttribute.Namespace Property?

This MSDN article recommends always to provide a namespace to a ServiceContract and DataContract.
Examples usually have a "schema" prefix and a URI type pattern for the namespace such as
Namespace="urn:WCFEssentials/Samples/2008/12"
instead of a traditional C# namespace with dot-notation such as
Namespace="MyNamespace.MyDataClasses"
What is the suggested format the namespace property? Do we need the schema prefix? Why is this format suggested?
Here are some additional suggestions from MSDN:
The namespace can be any string
but is traditionally a Uri representative of the company or application domain
and includes a year and month to support versioning scenarios.
For DataContracts, the namespace is often similar to the ServiceContract namespace
but uses using a “schemas” uri section
Example Service Contract with Namespace
[ServiceContract(Namespace="urn:CompanyName/ApplicationName/YYYY/MM")]
[ServiceContract(Namespace="urn:BigFont/EmailSystem/2014/03")]
Example Data Contract with "Schema" Segment in Namespace
[DataContract(Namespace="urn:CompanyName/Schema/YYYY/MM")]
[DataContract(Namespace="urn:BigFont/Schema/2014/03")]
Thank you to John Saunders or getting me started.
It's an XML Namespace. Those can either be in the urn: format or they can be URLs.

DomainContext not being generated in RIA Service for Silverlight 4

I have added my domain service but when I build my web project the DomainContext never gets generated. I am new to RIA Services and trying to learn but I am really stuck.
Here is my Domain Service
Option Compare Binary
Option Infer On
Option Strict On
Option Explicit On
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.ComponentModel.DataAnnotations
Imports System.Linq
Imports System.ServiceModel.DomainServices.Hosting
Imports System.ServiceModel.DomainServices.Server
Imports Wellness.BL
Imports System.Collections.ObjectModel
'TODO: Create methods containing your application logic.
<EnableClientAccess()> _
Public Class EventScheduleService
Inherits DomainService
Public Function GetEventSchedule(ByVal ScheduleYear As Integer) As IEnumerable(Of Models.EventSchedule)
Return DataServices.EventSchedulesDataService.GetEventSchedule(ScheduleYear)
End Function
End Class
Maybe Models.EventSchedule, the class that is the base for your IEnumerable, is in a library that you have referenced in the Web project but can not be referenced in the client as it is not a Silverlight library?
I think that would prevent the EventScheduleDataContext from being generated in the client.
A simple test would be to change base of the IEnumerable to a class that lives in the Web project.
I had this problem also. My problem was that Visual Studio was set to Release mode. Setting it to Debug mode solved it.

Working of "imports namespace"

I knew from here that we have to do the explicit imports for child namespace because imports will not include the child namespace.
But my question is that if I do "imports System" whether it will include all the classes/methods inside that namespace in the IL/native code or only referred ( used inside the application) will be included in the IL/native code.
Importing a namespace doesn't mean that anything is included in the code. It only means that the compiler recognises identifiers from that namespace.
The references in your project are what really decides which libraries the application is using. Still, the libraries are loaded when needed, they are not included in your executable file.