Здравствуйте, Пельмешко, Вы писали:
Я не слишком рано?
using System;
using System.Security;
using System.Collections.Specialized;
using System.Runtime.InteropServices;
class Program
{
[StructLayout(LayoutKind.Explicit)]
public struct MyBool
{
[FieldOffset(0)]
public byte Value1;
[FieldOffset(0)]
public bool Value2;
}
static void Main()
{
var ds = new SecretDataStorage();
var mb = new MyBool();
mb.Value1 = 128;
ds.GetData(null, mb.Value2);
}
public partial class SecretDataStorage
{
public string GetData(SecureString password, bool goodUser)
{
bool goodPass = CheckPass(password);
if (!goodPass != goodUser && goodUser)
{
return ResolveSecretData(); // <= попасть сюды
}
return null;
}
private bool CheckPass(SecureString password)
{
return false;
}
private string ResolveSecretData()
{
Console.WriteLine("We are here!");
return "";
}
}
}