Click here to Skip to main content
15,885,244 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
i am want one xml file for distributing, editing, reading in my multiple projects. how can i achieve this.
Posted
Comments
Sergey Alexandrovich Kryukov 10-Jan-13 16:53pm    
It depends on what do you mean by resource. Is it a resource embedded in an executable module or not? And why doing so?
—SA

1 solution

Put it in the common app data area, using Environment.GetFolder to get a path that all your apps can see.
 
Share this answer
 
Comments
mryeti 10-Jan-13 15:34pm    
is it possible to pass xml file path at runtime ? i created a library to manipulate xml but i am not able to use the the library in other project throughing error "An object reference is required for the non-static field, method, or property"
my c# code for library:-

public class Exam_XML
{
string docurl=null;

public string xml_path {
get { return docurl; }
set { docurl = value; }
}

#region EXAM

public static List<exam> GetExam()
{
try
{
XDocument data = XDocument.Load(docurl);
return (from exm in data.Descendants("test_details")
orderby (int)exm.Attribute("id")
select new Exam
{
examID = Convert.ToInt32(exm.Attribute("id").Value),
examNME = (string)exm.Attribute("name").Value,
examTME = Convert.ToInt32(exm.Attribute("time").Value),
examMRK = Convert.ToInt32(exm.Attribute("marks").Value),
examDifficulty = Convert.ToInt32(exm.Attribute("difficulty").Value)
}).ToList();
}
catch (Exception ex)
{
throw new ArgumentException(ex.Data+"\n"+ex.Message);
}
}
Christian Graus 10-Jan-13 15:36pm    
The error means what it says. You can't access docurl because the method is static, and the property is not. This has nothing to do with what you're asking. No, don't try to pass a path between apps, do what I told you to do.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900