internal static class Serializer
{
internal static void Serialize<T>(this T arg, string fileName)
{
string res = JsonConvert.SerializeObject(arg, Formatting.Indented);
File.WriteAllText(fileName,res);
}
internal static T Deserialize<T>(string fileName)
{
string json = File.ReadAllText(fileName);
T res = JsonConvert.DeserializeObject<T>(json);
return res;
}
}
public class Item
{
...
public string title{get; set;}
public string url{get;set;}
...
}
public class Response
{
public int count{get;set;}
public List<Item> items{get; set;}
}
string pathToFIle = @"C:\temp\anyFile";
Response response = Serializer.Deserialize<Response>(pathToFile);
String[] titles = response.items.Select(item => item.title).ToArray(); // Массив названий
String[] urls = response.items.Select(item => item.url)ToArray(); // Массив адресов
public class Example
{
public int id { get; set; }
public string idnetrikalpu { get; set; }
public string decription { get; set; }
public string district { get; set; }
public string externallpuid { get; set; }
public bool isactive { get; set; }
public string lpufullname { get; set; }
public string lpushortname { get; set; }
}
var fb = new WebClient() {Encoding = Encoding.UTF8}.DownloadString("http://91.237.82.1/api/v1/netrikalpu/?format=json");
var list = JsonConvert.DeserializeObject<List<Example>>(fb);
public class MyClass extends RelativeLayout {
private RectF mBounds = new RectF(0, 0, 0, 0);
private Paint mPaint = new Paint();
public MyClass(final Context context, final AttributeSet attrs, final int defStyle) {
super(context, attrs, defStyle);
setWillNotDraw(false); //разрешаем рисовать в ViewGroup
mPaint.setColor(Color.RED);
mPaint.setStyle(Paint.Style.FILL);
mPaint.setAntiAlias(true);
}
@Override
protected void onSizeChanged(final int width, final int height, final int oldw,
final int oldh) {
mBounds.left = 0;
mBounds.top = 0;
mBounds.right = width;
mBounds.bottom = height;
}
@Override
public void onDraw(final Canvas canvas) {
super.onDraw(canvas);
canvas.drawOval(mBounds, mPaint);
}
}
Необходимо найти сходства у этих строк по смыслу