从vb转换为c#My.Settings问题 [英] converting from vb to c# My.Settings problem
本文介绍了从vb转换为c#My.Settings问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好我有问题,我需要一些帮助,我正在尝试将vb.net应用程序转换为c#应用程序,我遇到了问题,我在VB中有这样的功能:
hello I have a problem and I need some help , I'm trying to convert vb.net application to c# application and I'm facing a problem ,I have a function like that in VB :
Private Sub OpenLogWriter()
Dim sFilePath As String = My.Settings.LogfilePath ' "d:\document\"
sFile = sFilePath & "klip_" & Replace(Date.Now.ToShortDateString, "/", "") & "_" & Replace(Date.Now.ToShortTimeString, ":", "") & ".txt"
oWrite = New IO.StreamWriter(sFile)
End Sub
我在互联网上转换为c#:
and I converted on internet like that to c# :
private void OpenLogWriter()
{
string sFilePath = MySettings.LogfilePath;
// "d:\document\"
sFile = sFilePath + "klip_" + Strings.Replace(System.DateTime.Now.ToShortDateString, "/", "") + "_" + Strings.Replace(System.DateTime.Now.ToShortTimeString, ":", "") + ".txt";
oWrite = new IO.StreamWriter(sFile);
}
我发现当我转换它时MY.settings无效我不知道VB,我不知道什么是MY.Settings的c#版本。
我甚至不知道我的转换是真的与否io.streamwriter不工作
任何人都可以帮助我
I found that when I converted it that MY.settings not working I don't know VB and I don't know what is the c# version of MY.Settings .
I don't know even my conversion I true or not because io.streamwriter not working
can anyone help me
推荐答案
下面是转换后的代码。
Below is the converted code.
private void OpenLogWriter()
{
string sFilePath = My.Settings.LogfilePath;
// "d:\document\"
sFile = sFilePath + "klip_" + Strings.Replace(System.DateTime.Now.ToShortDateString, "/", "") + "_" + Strings.Replace(System.DateTime.Now.ToShortTimeString, ":", "") + ".txt";
oWrite = new IO.StreamWriter(sFile);
}
这篇关于从vb转换为c#My.Settings问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文