When I try to serialize an object using xmlserializer,It is throwing out of memory exception.Is there any way to serialize large objects like more than 30 mb. I am able to serialize an object to xml file only if the size of the file after serialization is around 15 mb otherwise outofmemory exception is thrown
Hi all, can someone please clear things up for me regarding inheriting an abstract class. According to msdn.com[^] the following are some of the features of an abstract class:
It is not possible to modify an abstract class with the sealed modifier, which means that the class cannot be inherited.
A non-abstract class derived from an abstract class must include actual implementations of all inherited abstract methods and accessors.
The first sentence says that the class cannot be inherited but the second sentence says you can have a non-abstract class which is derived from an abstract class. If I'm not mistaken, a derived class is a class that inherits from another class. Thanks in advance for your response.
MSDN isn't always right and sometimes, like here, they don't update the documentation. If you follow the 'other versions' links, at the top of that page, to VS 2012, you'll see that the stuff about 'abstract sealed' has been changed.
It's possible that the person who wrote the docs was confusing C# and intermediate language (IL) classes. When a C# static class is compiled to IL, the class declaration is marked as abstract and sealed. So a C# static class is equivalent to an IL abstract sealed class.
In C# it's not actually possible to declare a class as 'abstract sealed'. Try it and you'll find that it won't compile.
I agree that this sentence could be clearer. What they're trying to say is:
You cannot add the sealed modifier to an abstract class;
The sealed modifier means that a class cannot be inherited;
It looks like they cleared this up in the VS2010 version[^], where the sentence has been changed to:
It is not possible to modify an abstract class with the sealed (C# Reference) modifier because the two modifers have opposite meanings. The sealed modifier prevents a class from being inherited and the abstract modifier requires a class to be inherited.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
In a C# 2008 application, I used linq to sql to connect to a sql server 2008 database. Now I want to obtain the connection of the database from the
app.config file instead of hardcoding the value into the application. I want to be able to change the connection string to the database since I will be moving this application from unit testing database to user acceptance database to the the prodction database.
Right now I am getting the error message, ""Object reference not set to an instance of an object." I know this error message is coming from the line of code that I listed below since it is the only line of code I changed.
The following is a snippet of the code from the *.designer.cs file (this is part of the dbml file).
public esampleDataContext() :
**Note: base(global::sample.Properties.Settings.Default.DEVConnectionString, mappingSource) is the line of code that I replaced that was generated by the
I want to mention the following:
1. The *.dbml file is associated with a particular project file.
2. The connection string settings for this *.dbml file are the following:
a. DEVConnectionString (settings)
b. Connection String = Data Source=dev1;Initial Catalog=DEV_test;Integrated Security=True
c. application settings=True
d. settings property name is DEVConnectionString.
3. The project file that has the *.dbml file. has a reference set to the system.configuration.
**Note: This code in similar applications that I wrote, but I do not why it does not work here.
Thus can you tell me, show me in code, and/or point me to a reference that I can use so I can obtain the value in the app.config file for the database connection string I want to use. I do not want to use a hard-coded connection string to the database.
point me to a reference that I can use so I can obtain the value in the app.config file for the database connection string I want to use. I do not want to use a hard-coded connection string to the database.
Correct me if I'm wrong, but isn't the connectionstring in the app.config file? Isn't the app.config file an XML file that can be edited?
If both answers are yes, then your connectionstring isn't hardcoded, but loaded from the settings-file.