Нашел ссылку, очень много полезных примеров применения LINQ
http://code.msdn.microsoft.com/101-LINQ-Samples-3fb9811b
с# Serialization to file or string / с# Сериализация в файл или в строку + Десериализация
static void SerializeToFile(object o) { XmlSerializer serializer = new XmlSerializer(o.GetType()); using (Stream writer = new FileStream("output.xml", FileMode.Create)) { serializer.Serialize(writer, o); } } public static string SerializeToString(object obj) { XmlSerializer serializer = new XmlSerializer(obj.GetType()); using (StringWriter writer = new StringWriter()) { serializer.Serialize(writer, obj); return writer.ToString(); } } public static object DeserializeFromFile(object obj,string path) { XmlSerializer serializer = new XmlSerializer(obj.GetType()); using (XmlReader reader = XmlReader.Create(path)) { object o = serializer.Deserialize(reader); } } //From string var serializer = new XmlSerializer(typeof(Car)); using (var reader = new StringReader(xml)) { var car = (Car)serializer.Deserialize(reader); }
Изменить строку подключения в app.conig / How to change connection string in app.config
static void AddConnectionStringMyDB() { System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration( ConfigurationUserLevel.None); ConnectionStringsSection csSection = config.ConnectionStrings; ConnectionStringSettings connection = new ConnectionStringSettings(); connection.Name = "Rozn_Client.Properties.Settings.userDBConnectionString"; connection.ProviderName = "Microsoft.SqlServerCe.Client.4.0"; connection.ConnectionString = "Data Source=|DataDirectory|\\myDB.sdf;Password=mypassword;Persist Security Info=True"; csSection.ConnectionStrings.Add(connection); config.Save(ConfigurationSaveMode.Modified); ConfigurationManager.RefreshSection("connectionStrings"); }
C# Get the version of your solution in Visual Studio
string s1 = Application.ProductVersion; //Only product version string s2 = System.Reflection.Assembly.GetExecutingAssembly().FullName; // Returns Project1, Version=1.0.2281.26155, Culture=neutral, PubliKeyToken=null
Чем просматривать/редактировать/удалять/смотреть версию sdf
http://sourceforge.net/p/compactview/home/Home/ я использовал вот этот опенсорс инструмент
c# получить из сертификата открытый и закрытый ключ / Get from X509 certificate private and public keys
X509Certificate2 cert = new X509Certificate2("cert.pfx"); //(RSACryptoServiceProvider)cert.PrivateKey //(RSACryptoServiceProvider)cert.PublicKey.Key
c# проверяем подпись сертификата x509 у файла / c# Verify x509 certificate signature
public static bool CertificateSignVerify(string signFilePath, byte[] data, RSACryptoServiceProvider rsaKey) { byte[] signature = File.ReadAllBytes(signFilePath); return rsaKey.VerifyData(data, new SHA1CryptoServiceProvider(), signature); }
Subscribe to:
Posts (Atom)