本文整理汇总了C#中UserProfile.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# UserProfile.ToString方法的具体用法?C# UserProfile.ToString怎么用?C# UserProfile.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserProfile
的用法示例。
在下文中一共展示了UserProfile.ToString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateProfile
public static void CreateProfile(string userStorePath, UserProfile profile)
{
var filePath = Path.Combine(userStorePath, profile.Username.ToLower());
if (File.Exists(filePath))
throw new ApplicationException("Username already exists");
using (var writer = new StreamWriter(filePath))
{
using (var md5 = MD5.Create())
profile.Password = GetMd5Hash(md5, profile.Password);
writer.Write(profile.ToString());
}
}
示例2: Main
static void Main()
{
Rectangle firstRect = new Rectangle(5.0f, 2.3f);
Console.WriteLine("Rectangle 1 is {0}x{1} and has area {2}",
firstRect.Height, firstRect.Width, firstRect.Area);
Rectangle secondRect2 = new Rectangle(3.0f, 4.0f);
Console.WriteLine("Rectangle 2 is {0}x{1} and has area {2}",
secondRect2.Height, secondRect2.Width, secondRect2.Area);
// Can't set a value to readonly property!
//secondRect.Area = 20.3f;
Console.WriteLine();
UserProfile profile = new UserProfile(91112, "Steve", "Balmer");
string proba = profile.ToString();
Console.WriteLine(proba);
// Can't assign a private set property!
// profile.UserId = 12345;
}
示例3: UpdateEbayProfile
/// <summary>
/// Updates or inserts an ebay profile
/// </summary>
/// <param name="UrlID"></param>
/// <param name="username"></param>
/// <param name="feedback"></param>
/// <param name="positive"></param>
private void UpdateEbayProfile(UserProfile profile)
{
try
{
AddToReportQueue(CWLoggerEntryType.Info, "Ebay Plugin is updating User Profile with " + profile.ToString());
try
{
dbcon.Open();
}
catch
{ }
if (dbcon.State == ConnectionState.Closed)
{
//log a message
return;
}
SqlCommand cmd = new SqlCommand("cw_insert_update_ebay_profile", dbcon);
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandTimeout = settings.DBActionTimeout;
cmd.Parameters.Add("@urlid", SqlDbType.Int);
cmd.Parameters.Add("@username", SqlDbType.NVarChar, 50);
cmd.Parameters.Add("@feedback", SqlDbType.Int);
cmd.Parameters.Add("@positive", SqlDbType.Float);
cmd.Parameters[0].Value = profile.UrlID;
cmd.Parameters[1].Value = profile.Username;
cmd.Parameters[2].Value = profile.Feedback;
cmd.Parameters[3].Value = profile.Positive;
cmd.ExecuteNonQuery();
cmd.Dispose();
dbcon.Close();
}
catch (Exception e)
{
AddToReportQueue(CWLoggerEntryType.Warning, "Ebay Plugin failed to update the profile of the user " + profile.Username + ": " + e.Message);
if (dbcon.State != ConnectionState.Closed)
{
try
{
dbcon.Close();
}
catch
{ }
}
GC.Collect();
}
}
示例4: UpdateProfile
public static void UpdateProfile(string userStorePath, UserProfile profile)
{
var filePath = Path.Combine(userStorePath, profile.Username.ToLower());
File.WriteAllText(filePath, profile.ToString());
}